Skip to content

[PR] Adding deployment guide #9

[PR] Adding deployment guide

[PR] Adding deployment guide #9

name: Deploy Android (Google Play Store)
on:
# Only trigger, when the "build" workflow succeeded (only works in the Master Branch)
workflow_run:
workflows: ["Build & Test"]
types:
- completed
# Only trigger, when pushing into the `main` branch
push:
branches: [main]
# DELETE THIS
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
build-and-deploy_android:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v3
# Needed to base64 decode the upload keystore
- name: ⚙️ Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: "12.x"
cache: 'gradle'
id: java
# Needed to run Flutter-based commands
- name: 🐦 Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.13.5"
channel: "stable"
- name: 📚 Install dependencies
run: flutter pub get
- name: 🔒 Retrieve base64 keystore and decode it to a file
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_FILE_BASE64 }}
run: echo $KEYSTORE_BASE64 | base64 --decode > "${{ github.workspace }}/decoded_android-keystore.jks"
# Creates keystore file.
# Needs to be the same as the one defined in `android/app/build.gradle`
- name: 📝🔐 Create key.properties file
env:
KEYSTORE_PROPERTIES_PATH: ${{ github.workspace }}/android/key.properties
run: |
touch $KEYSTORE_PROPERTIES_PATH
echo 'storeFile=${{ github.workspace }}/decoded_android-keystore.jks' > $KEYSTORE_PROPERTIES_PATH
echo 'keyAlias=${{ secrets.KEYSTORE_KEY_ALIAS }}' >> $KEYSTORE_PROPERTIES_PATH
echo 'storePassword=${{ secrets.KEYSTORE_PASSWORD }}' >> $KEYSTORE_PROPERTIES_PATH
echo 'keyPassword=${{ secrets.KEYSTORE_KEY_PASSWORD }}' >> $KEYSTORE_PROPERTIES_PATH
- name: 📦 Create Android appbundle release
run: |
flutter build appbundle \
--obfuscate \
--split-debug-info=${{ github.workspace }}/debug_info
- name: 🚀 Upload Android Release to Play Store
uses: r0adkll/[email protected]
with:
# MUST match the package name defined in `android/app/build.gradle`
packageName: "com.dwyl.app"
# Can be 'alpha'/'beta'/'internal'/'production'
track: production
releaseFiles: ${{ github.workspace }}/build/app/outputs/bundle/release/app-release.aab
serviceAccountJsonPlainText: "${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_KEY_JSON }}"