Build APK and publish #2
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: Build APK and publish | |
on: [push, pull_request, workflow_dispatch, workflow_call] | |
permissions: write-all | |
jobs: | |
build-apk: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: "Setup: Java" | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: "Setup: Install additional dependencies" | |
run: sudo apt-get install -y ispell | |
- uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw== | |
gradle-home-cache-cleanup: true | |
- name: Build APK | |
run: | | |
chmod +x gradlew | |
./gradlew assembleFlavorDefaultRelease | |
- name: current dir | |
run: | | |
pwd | |
ls -la app/build/outputs/apk/flavorDefault/release | |
- name: Setup build tool version variable | |
shell: bash | |
run: | | |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) | |
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV | |
echo Last build tool version is: $BUILD_TOOL_VERSION | |
- name: Sign APK | |
uses: r0adkll/sign-android-release@v1 | |
id: sign_app | |
with: | |
releaseDirectory: app/build/outputs/apk/flavorDefault/release | |
signingKeyBase64: ${{ secrets.KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.PASSWORD }} | |
keyPassword: ${{ secrets.PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} | |
- name: Output Signed APK | |
run: echo 'Signed APK is ${{ steps.sign_app.outputs.signedReleaseFile }}' | |
- name: Publish GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ github.run_number }} | |
prerelease: false | |
draft: false | |
body: ${{ github.event.head_commit.message }} | |
files: ${{ steps.sign_app.outputs.signedReleaseFile }} | |
name: ${{ github.run_number }} | |