From 07e0f53eebb7ce1fa674374b3d256164e293de88 Mon Sep 17 00:00:00 2001 From: Alberto Del Buono Paolini Date: Fri, 24 May 2024 18:20:33 +0200 Subject: [PATCH] Updated android apk build action --- .github/workflows/android.yml | 28 ++++++++++++++++++++++++---- .gitignore | 3 ++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 3710ea3..f8a394a 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,4 +1,4 @@ -name: Build Android App +name: Build Android App (.apk) on: # push: @@ -14,9 +14,18 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout code uses: actions/checkout@v4 + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: "temurin" + java-version: 17 + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + - name: Setup Rust uses: actions-rs/toolchain@v1 with: @@ -51,11 +60,22 @@ jobs: DATABASE_URL: ${{ secrets.DATABASE_URL }} run: printf "API_URL=$API_URL\nSUPABASE_URL=$SUPABASE_URL\nSUPABASE_API_KEY=$SUPABASE_API_KEY\nSUPABASE_JWT_SECRET=$SUPABASE_JWT_SECRET\nDATABASE_URL=$DATABASE_URL\n" > .env - # TODO: Sign the APKs using a keystore - - name: Build run: mv Cargo.toml Cargo.toml.bak && cp Cargo.mobile.toml Cargo.toml && cargo android apk build --release --split-per-abi + - name: Sign APKs with keystore + env: + ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }} + ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} + ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }} + run: | + echo $ANDROID_KEYSTORE > release.keystore.asc + gpg -d --passphrase $ANDROID_KEYSTORE_PASSWORD --batch --yes release.keystore.asc > release.keystore + jarsigner -keystore release.keystore ./gen/android/app/build/outputs/apk/arm/release/app-arm-release-unsigned.apk $ANDROID_KEYSTORE_ALIAS + jarsigner -keystore release.keystore ./gen/android/app/build/outputs/apk/arm64/release/app-arm64-release-unsigned.apk $ANDROID_KEYSTORE_ALIAS + jarsigner -keystore release.keystore ./gen/android/app/build/outputs/apk/x86/release/app-x86-release-unsigned.apk $ANDROID_KEYSTORE_ALIAS + jarsigner -keystore release.keystore ./gen/android/app/build/outputs/apk/x86_64/release/app-x86_64-release-unsigned.apk $ANDROID_KEYSTORE_ALIAS + - name: Upload artifact uses: actions/upload-artifact@v4 with: diff --git a/.gitignore b/.gitignore index 01b0eae..f34c441 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,5 @@ Cargo.toml.bak .env # Android signing -*.keystore \ No newline at end of file +*.keystore +*.keystore.asc \ No newline at end of file