Build Android Release Package #4
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 Android Release Package | |
on: | |
workflow_dispatch: | |
jobs: | |
android-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Create Sekrets | |
run: | | |
./gradlew createSekretProperties -Pkey=GITHUB_CLIENT_ID -Pvalue=${{ secrets.GH_CLIENT_ID }}; | |
./gradlew createSekretProperties -Pkey=GITHUB_CLIENT_SECRET -Pvalue=${{ secrets.GH_CLIENT_SECRET }}; | |
./gradlew createSekretProperties -Pkey=FIREBASE_PROJECT -Pvalue=${{ secrets.FIREBASE_PROJECT }}; | |
./gradlew createSekretProperties -Pkey=FIREBASE_APPLICATION -Pvalue=${{ secrets.FIREBASE_APPLICATION }}; | |
./gradlew createSekretProperties -Pkey=FIREBASE_API_KEY -Pvalue=${{ secrets.FIREBASE_API_KEY }} | |
- name: Generate Sekrets | |
run: ./gradlew composeApp:generateSekret | |
- name: Downgrade Sekret (for shitty Samsung phones) | |
run: sed -i 's/sekret = "2.0.0-alpha-08"/sekret = "2.0.0-alpha-07"/' ./gradle/libs.versions.toml | |
- name: Build Sekret binary | |
run: ./gradlew composeApp:createSekretNativeBinary | |
- name: Copy Sekrets | |
run: ./gradlew composeApp:copySekretNativeBinary | |
- name: Build | |
continue-on-error: true | |
run: ./gradlew build | |
- name: Package | |
run: ./gradlew composeApp:assembleRelease && ./gradlew composeApp:bundleRelease | |
- name: Move APK file(s) | |
run: mv ./composeApp/build/outputs/apk/release/*.apk ./composeApp/release/ | |
- name: Move AAB file(s) | |
run: mv ./composeApp/build/outputs/bundle/release/*.aab ./composeApp/release/ | |
- name: Remove "-unsigned" from filename(s) | |
run: for filename in ./composeApp/release/*-unsigned*; do mv "./$filename" "./$(echo "$filename" | sed -e 's/-unsigned//g')"; done | |
- uses: ilharp/sign-android-release@v1 | |
id: sign_app | |
with: | |
releaseDir: composeApp/release | |
signingKey: ${{ secrets.ANDROID_SIGNING_KEY }} | |
keyAlias: ${{ secrets.ANDROID_KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
- name: Split signed files | |
uses: xom9ikk/split@v1 | |
id: split | |
with: | |
string: ${{ steps.sign_app.outputs.signedFiles }} | |
separator: ':' | |
limit: 2 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
path: | | |
${{ steps.split.outputs._0 }} | |
${{ steps.split.outputs._1 }} | |
retention-days: 1 |