| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- name: Build Release
- on:
- workflow_dispatch:
- inputs:
- release-tag:
- description: 'Release Tag (v2.x.x)'
- required: true
- jobs:
- BuildRelease:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout Repository
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Checkout submodules
- run: git submodule update --init --recursive --remote
- - name: Setup Java
- uses: actions/setup-java@v3
- with:
- distribution: 'zulu'
- java-version: 17
- - name: Setup Go
- uses: actions/setup-go@v3
- with:
- go-version: "1.20"
- - uses: actions/cache@v3
- with:
- path: |
- ~/.cache/go-build
- ~/go/pkg/mod
- key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- restore-keys: |
- ${{ runner.os }}-go-
-
- - name: Convert and set version env
- id: process-version
- run: |
- VERSION_TAG=${{ inputs.release-tag }}
- VERSION_TAG=${VERSION_TAG#v} # remove the 'v' prefix
- IFS='.' read -ra VERSION_PARTS <<< "$VERSION_TAG" # split into array
- VERSION_CODE=$(printf "%1d%02d%03d" "${VERSION_PARTS[0]}" "${VERSION_PARTS[1]}" "${VERSION_PARTS[2]}")
-
- echo "versonName=$VERSION_TAG" >> $GITHUB_OUTPUT # "1.2.3"
- echo "versonCode=$VERSION_CODE" >> $GITHUB_OUTPUT # "102003"
-
- # Re-write version in build.gradle.kts
- - name: Re-write version
- uses: Devofure/advance-android-version-actions@v1.4
- with:
- gradlePath: build.gradle.kts
- versionCode: ${{ steps.process-version.outputs.versonCode }}
- versionName: ${{ steps.process-version.outputs.versonName }}
-
- # If any change found, commit it and push
- - name: Commit and push if changes
- run: |
- changes=$(git diff --name-only origin/main | wc -l)
- if [ $changes -gt 0 ]
- then
- newVersionName=${{ steps.process-version.outputs.versonName }}
- newVersionCode=${{ steps.process-version.outputs.versonCode }}
- git config --global user.name 'GitHub Action'
- git config --global user.email 'action@github.com'
- git add build.gradle.kts
- git commit -am "Bump version to $newVersionName ($newVersionCode)"
- git tag "v$newVersionName"
- git push --follow-tags
- fi
- - name: Signing properties
- env:
- SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
- SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
- SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
- run: |
- touch signing.properties
- echo keystore.password="$SIGNING_STORE_PASSWORD" > signing.properties
- echo key.alias="$SIGNING_KEY_ALIAS" >> signing.properties
- echo key.password="$SIGNING_KEY_PASSWORD" >> signing.properties
-
- echo "cat signing.properties"
- cat signing.properties
- - name: Release Build
- if: success()
- uses: gradle/gradle-build-action@v2
- with:
- arguments: --no-daemon app:assembleMetaRelease
- - name: Tag Repo
- uses: richardsimko/update-tag@v1
- with:
- tag_name: ${{ inputs.release-tag }}
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Upload Release
- uses: softprops/action-gh-release@v1
- if: ${{ success() }}
- with:
- tag_name: ${{ inputs.release-tag }}
- files: app/build/outputs/apk/meta/release/*
- generate_release_notes: true
- - name: Release Changelog Builder
- uses: mikepenz/release-changelog-builder-action@v3.6.0
- with:
- configurationJson: |
- {
- "ignore_labels": [
- "Update"
- ],
- }
|