diff --git a/.github/workflows/android-play-store.yml b/.github/workflows/android-play-store.yml index 749ea4cab..1b00e741e 100644 --- a/.github/workflows/android-play-store.yml +++ b/.github/workflows/android-play-store.yml @@ -29,14 +29,19 @@ jobs: restore-keys: | ${{ runner.OS }}-saber- - - name: Remove signingConfig - run: ./patches/remove_signing_android.sh - - name: Remove REQUEST_INSTALL_PACKAGES permission run: ./patches/remove_request_install_packages_permission.sh - name: Remove simulator dependency run: ./patches/remove_simulator_dependency.sh + + - name: Setup keystore + run: | + echo "${{ secrets.SIGNING_KEY }}" | base64 -d > android/android.keystore + echo "storePassword=${{ secrets.KEY_STORE_PASSWORD }}" > android/key.properties + echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties + echo "keyAlias=${{ secrets.ALIAS }}" >> android/key.properties + echo "storeFile=../android.keystore" >> android/key.properties - name: Setup Flutter uses: subosito/flutter-action@v2 @@ -64,24 +69,11 @@ jobs: --dart-define=UPDATE_CHECK="false" \ --dart-define=DIRTY="false" - - name: Move unsigned apk + - name: Rename aab run: | mkdir -p output mv build/app/outputs/bundle/release/app-release.aab output/Saber.aab - - name: Sign aab - uses: ilharp/sign-android-release@v1 - id: sign_app - with: - releaseDir: output - signingKey: ${{ secrets.SIGNING_KEY }} - keyAlias: ${{ secrets.ALIAS }} - keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} - keyPassword: ${{ secrets.KEY_PASSWORD }} - - - name: Rename signed apk - run: mv ${{ steps.sign_app.outputs.signedFile }} output/Saber.aab - - name: Upload artifact uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 4b33a0fa6..fea5aae5d 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -33,6 +33,14 @@ jobs: - name: Remove simulator dependency run: ./patches/remove_simulator_dependency.sh + + - name: Setup keystore + run: | + echo "${{ secrets.SIGNING_KEY }}" | base64 -d > android/android.keystore + echo "storePassword=${{ secrets.KEY_STORE_PASSWORD }}" > android/key.properties + echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties + echo "keyAlias=${{ secrets.ALIAS }}" >> android/key.properties + echo "storeFile=../android.keystore" >> android/key.properties - name: Setup Flutter uses: subosito/flutter-action@v2 @@ -59,29 +67,16 @@ jobs: env: DIRTY: ${{ !startsWith(github.ref, 'refs/tags/') }} - - name: Move unsigned apk - run: | - mkdir -p output - mv build/app/outputs/flutter-apk/app-release.apk output/ - - - name: Sign apk - uses: ilharp/sign-android-release@v1 - id: sign_app - with: - releaseDir: output - signingKey: ${{ secrets.SIGNING_KEY }} - keyAlias: ${{ secrets.ALIAS }} - keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} - keyPassword: ${{ secrets.KEY_PASSWORD }} - - - name: Rename signed apk + - name: Rename apk id: rename_apk run: | buildName=$(grep -oP "(?<=buildName = ').*(?=')" lib/data/version.dart) apkName="Saber_v${buildName}.apk" - mv ${{ steps.sign_app.outputs.signedFile }} output/$apkName echo "apkName=$apkName" >> $GITHUB_OUTPUT + mkdir -p output + mv build/app/outputs/flutter-apk/app-release.apk output/$apkName + - name: Upload artifact uses: actions/upload-artifact@v4 with: @@ -119,6 +114,14 @@ jobs: - name: Remove simulator dependency run: ./patches/remove_simulator_dependency.sh + + - name: Setup keystore + run: | + echo "${{ secrets.SIGNING_KEY }}" | base64 -d > android/android.keystore + echo "storePassword=${{ secrets.KEY_STORE_PASSWORD }}" > android/key.properties + echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties + echo "keyAlias=${{ secrets.ALIAS }}" >> android/key.properties + echo "storeFile=../android.keystore" >> android/key.properties - name: Setup Flutter uses: subosito/flutter-action@v2 @@ -145,29 +148,16 @@ jobs: env: DIRTY: ${{ !startsWith(github.ref, 'refs/tags/') }} - - name: Move unsigned apk - run: | - mkdir -p output - mv build/app/outputs/flutter-apk/app-release.apk output/ - - - name: Sign apk - uses: ilharp/sign-android-release@v1 - id: sign_app - with: - releaseDir: output - signingKey: ${{ secrets.SIGNING_KEY }} - keyAlias: ${{ secrets.ALIAS }} - keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} - keyPassword: ${{ secrets.KEY_PASSWORD }} - - - name: Rename signed apk + - name: Rename apk id: rename_apk run: | buildName=$(grep -oP "(?<=buildName = ').*(?=')" lib/data/version.dart) apkName="Saber_FOSS_v${buildName}.apk" - mv ${{ steps.sign_app.outputs.signedFile }} output/$apkName echo "apkName=$apkName" >> $GITHUB_OUTPUT + mkdir -p output + mv build/app/outputs/flutter-apk/app-release.apk output/$apkName + - name: Upload artifact uses: actions/upload-artifact@v4 with: diff --git a/patches/remove_signing_android.sh b/patches/remove_signing_android.sh deleted file mode 100755 index 9fd2b0f74..000000000 --- a/patches/remove_signing_android.sh +++ /dev/null @@ -1,5 +0,0 @@ -# This patch is necessary when building an appbundle on GitHub Actions, -# as the signing action will fail if the .aab was already signed. - -# Remove `signingConfig signingConfigs.release` from android/app/build.gradle -sed -i -e 's/signingConfig signingConfigs.release//g' android/app/build.gradle