Skip to content

[PR] Adding deployment guide #4

[PR] Adding deployment guide

[PR] Adding deployment guide #4

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]
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