Skip to content

Android release

Android release #9

name: Android release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
jobs:
unit_tests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Unit tests
run: ./gradlew testDebugUnitTest
- name: Generate code coverage
run: ./gradlew shared:koverXmlReportDebug
- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: code-coverage.xml
path: shared/build/coverage-report/result.xml
build:
needs: unit_tests
runs-on: macos-latest
strategy:
matrix:
format: [
{ type: "apk", command: "assembleRelease", output: "apk" },
{
type: "aab",
command: "generateReleaseBaseline
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile
-Pandroid.testoptions.manageddevices.emulator.gpu=\"swiftshader_indirect\"
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
-Pandroid.experimental.androidTest.numManagedDeviceShards=1
-Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1
bundleRelease",
output: "bundle"
}
]
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Clean GMD
run: ./gradlew cleanManagedDevices --unused-only
- name: Decode Keystore
env:
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE_ENCODED }}
run: |
echo $ENCODED_KEYSTORE > keystore-b64.txt
base64 -d -i keystore-b64.txt > ./androidApp/keystore.jks
- name: Build release
env:
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
KEYSTORE_PATH: keystore.jks
run: ./gradlew ${{ matrix.format.command }}
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: app-release.${{ matrix.format.type }}
path: androidApp/build/outputs/${{ matrix.format.output }}/release/*.${{ matrix.format.type }}
- name: Upload mapping folder
uses: actions/upload-artifact@v4
with:
name: mapping-${{ matrix.format.type }}
path: androidApp/build/outputs/mapping/
release:
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Tag Release
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}
- name: Download APK
uses: actions/download-artifact@v4
with:
name: app-release.apk
- name: Download APK mapping
uses: actions/download-artifact@v4
with:
name: mapping-apk
path: mapping-apk
- name: Zip APK mapping
run: |
zip -r mapping-apk.zip mapping-apk/
- name: Download AAB
uses: actions/download-artifact@v4
with:
name: app-release.aab
- name: Download AAB mapping
uses: actions/download-artifact@v4
with:
name: mapping-aab
path: mapping-aab
- name: Zip AAB mapping
run: |
zip -r mapping-aab.zip mapping-aab/
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "*.apk,*.aab,mapping-apk.zip,mapping-aab.zip"
draft: true
name: ${{ github.event.inputs.version }}
tag: ${{ github.event.inputs.version }}