Merge pull request #443 from lihenggui/mercury #34
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GitHub Release with APKs | |
on: | |
push: | |
tags: | |
- 'v*' | |
- '!v*-fdroid' | |
jobs: | |
build: | |
runs-on: self-hosted | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
fetch-depth: 0 | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Write sign info | |
run: | | |
if [ ! -z "${{ secrets.KEYSTORE }}" ]; then | |
echo releaseStorePassword='${{ secrets.SIGNING_STORE_PASSWORD }}' >> gradle.properties | |
echo releaseKeyAlias='${{ secrets.SIGNING_KEY_ALIAS }}' >> gradle.properties | |
echo releaseKeyPassword='${{ secrets.SIGNING_KEY_PASSWORD }}' >> gradle.properties | |
echo releaseStoreFile='${{ github.workspace }}/key.jks' >> gradle.properties | |
echo ${{ secrets.KEYSTORE }} | base64 --decode > ${{ github.workspace }}/key.jks | |
fi | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2.9.0 | |
- name: Accept Android licenses | |
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true | |
- name: Build app | |
run: ./gradlew :app-compose:assembleRelease :app-compose:bundleRelease | |
- name: Set apk path | |
id: apk-path | |
run: | | |
foss_path=$(find **/build/outputs/apk/foss -name '*.apk' -type f | head -1) | |
echo "foss_path=$foss_path" >> $GITHUB_OUTPUT | |
market_path=$(find **/build/outputs/apk/market -name '*.apk' -type f | head -1) | |
echo "market_path=$market_path" >> $GITHUB_OUTPUT | |
- name: Get apk info | |
id: apk-info | |
uses: zhaobozhen/apk-info-action@1.1.2 | |
with: | |
apk-path: ${{ steps.apk-path.outputs.foss_path }} | |
- name: Build Changelog | |
id: build_changelog | |
uses: mikepenz/release-changelog-builder-action@v4.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} | |
- name: Write whats new info | |
run: | | |
mkdir -p ${{ github.workspace }}/distribution/whatsnew/ | |
echo '${{ steps.build_changelog.outputs.changelog }}' | head -c 490 >> ${{ github.workspace }}/distribution/whatsnew/whatsnew-en-US | |
- name: Upload built Market apk | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Blocker-${{ steps.apk-info.outputs.version-name }}-market-release.apk | |
path: ${{ steps.apk-path.outputs.market_path }} | |
- name: Upload built Foss apk | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Blocker-${{ steps.apk-info.outputs.version-name }}-foss-release.apk | |
path: ${{ steps.apk-path.outputs.foss_path }} | |
- name: Upload mappings | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mappings | |
path: "app-compose/build/outputs/mapping/marketRelease" | |
- name: Publish to Play Store open beta track | |
uses: r0adkll/upload-google-play@v1.1.2 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }} | |
packageName: com.merxury.blocker | |
releaseFiles: app-compose/build/outputs/bundle/marketRelease/app-compose-market-release.aab | |
track: beta | |
inAppUpdatePriority: 2 | |
mappingFile: app-compose/build/outputs/mapping/marketRelease/mapping.txt | |
whatsNewDirectory: ${{ github.workspace }}/distribution/whatsnew | |
- name: Rename output APKs | |
run: | | |
mv ${{ steps.apk-path.outputs.market_path }} Blocker-${{ steps.apk-info.outputs.version-name }}-market-release.apk | |
mv ${{ steps.apk-path.outputs.foss_path }} Blocker-${{ steps.apk-info.outputs.version-name }}-foss-release.apk | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} | |
with: | |
tag_name: v${{ steps.apk-info.outputs.version-name }} | |
draft: false | |
prerelease: true | |
append_body: true | |
generate_release_notes: true | |
body: ${{steps.build_changelog.outputs.changelog}} | |
files: | | |
Blocker-${{ steps.apk-info.outputs.version-name }}-market-release.apk | |
Blocker-${{ steps.apk-info.outputs.version-name }}-foss-release.apk |