Android — Deploy #38
This file contains hidden or 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: Android — Deploy | |
| # Manual only — does not run on push/PR. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| track: | |
| description: Google Play track (only used when uploading to Play) | |
| type: choice | |
| default: internal | |
| options: [internal, alpha, beta, production] | |
| # ── Required repo secrets (Settings → Secrets and variables → Actions) ──────── | |
| # GOOGLE_SERVICES_JSON base64 of android/app/google-services.json | |
| # ANDROID_KEYSTORE_BASE64 base64 of the upload keystore (.jks) | |
| # ANDROID_KEYSTORE_PASSWORD keystore (store) password | |
| # ANDROID_KEY_ALIAS key alias | |
| # ANDROID_KEY_PASSWORD key password | |
| # PLAY_SERVICE_ACCOUNT_JSON Play Console service-account JSON (only for upload) | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # The signed .aab is always published as a workflow artifact. Uploading to the | |
| # Play Console is opt-in (the very first release must be uploaded by hand). | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| jobs: | |
| deploy: | |
| name: Build & deploy to Google Play | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: 3.44.0 | |
| channel: stable | |
| cache: true | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Analyze | |
| run: flutter analyze | |
| - name: Restore Firebase config | |
| env: | |
| GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
| run: echo "$GOOGLE_SERVICES_JSON" | base64 --decode > android/app/google-services.json | |
| - name: Decode upload keystore | |
| env: | |
| ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
| run: echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > android/app/upload-keystore.jks | |
| - name: Write key.properties | |
| env: | |
| STORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
| KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
| run: | | |
| cat > android/key.properties <<EOF | |
| storePassword=$STORE_PASSWORD | |
| keyPassword=$KEY_PASSWORD | |
| keyAlias=$KEY_ALIAS | |
| storeFile=upload-keystore.jks | |
| EOF | |
| - name: Build App Bundle | |
| run: flutter build appbundle --release --build-number=${{ github.run_number }} | |
| - name: Upload AAB artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-release-aab | |
| path: build/app/outputs/bundle/release/app-release.aab | |
| if-no-files-found: error | |
| - name: Upload to Google Play | |
| uses: r0adkll/upload-google-play@v1 | |
| with: | |
| serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }} | |
| packageName: app.auaha.functionalparenting | |
| releaseFiles: build/app/outputs/bundle/release/app-release.aab | |
| track: ${{ inputs.track }} | |
| status: completed |