Skip to content

Build and release Flutter App #3

Build and release Flutter App

Build and release Flutter App #3

Workflow file for this run

name: Build and release Flutter App
on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for the release'
required: true
jobs:
build-app:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout 📥
uses: actions/[email protected]
- name: Get google-services.json 🗝
id: google_services
uses: timheuer/[email protected]
with:
fileName: google-services.json
fileDir: './android/app/'
encodedString: ${{ secrets.GOOGLE_SERVICES }}
- name: Get firebase_options.dart 🗂️
id: firebase_options
uses: timheuer/[email protected]
with:
fileName: firebase_options.dart
fileDir: './lib/'
encodedString: ${{ secrets.FIREBASE_OPTIONS }}
- name: Get env file 🗝
id: env_file
uses: timheuer/[email protected]
with:
fileName: .env
fileDir: './env/'
encodedString: ${{ secrets.ENV_FILE }}
- name: Get keystore file 🗝
id: android_keystore
uses: timheuer/[email protected]
with:
fileName: keystore.jks
fileDir: './android/app/'
encodedString: ${{ secrets.KEYSTORE }}
- name: Debug Keystore Path 🐛
run: |
echo "Keystore file path: ${{ steps.android_keystore.outputs.filePath }}"
ls -la ./android/app
- name: Write Keystore properties 🗝️
run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > android/key.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
- name: Setup Java ☕
uses: actions/[email protected]
with:
distribution: 'adopt'
java-version: "17.x"
cache: 'gradle'
- name: Setup Flutter 📱
uses: subosito/[email protected]
with:
channel: 'stable'
flutter-version: '${{ vars.FLUTTER_VERSION }}'
- name: Install dependencies 📦
run: flutter pub get
- name: Run build_runner 🏗️
run: dart run build_runner build --delete-conflicting-outputs
- name: Build Android App (fat APK) 📦
run: flutter build apk
- name: Build Android App (Multiple APKs) 📦📦
run: flutter build apk --split-per-abi
- name: Rename files ✏️
run: |
cd build/app/outputs/flutter-apk &&
mv app-release.apk password_generator-universal.apk &&
mv app-arm64-v8a-release.apk password_generator-arm64.apk &&
mv app-armeabi-v7a-release.apk password_generator-armeabi.apk &&
mv app-x86_64-release.apk password_generator-x86.apk
- name: Upload APKs 🚀
uses: softprops/[email protected]
with:
files: 'build/app/outputs/flutter-apk/*.apk'
tag_name: ${{ github.event.inputs.tag_name }}
token: ${{ secrets.GH_TOKEN }}