Skip to content

Build and upload assets #3

Build and upload assets

Build and upload assets #3

Workflow file for this run

name: Build and upload assets
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.22.3
- run: flutter --version
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Get dependencies
run: flutter pub get
- name: Run code generation
run: dart run build_runner build
- name: Decode keystore & build Android
env:
SIGNING_KEYSTORE: "keystore.jks"
SIGNING_KEYSTORE_PASSWORD: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: |
echo "${{ secrets.SIGNING_KEYSTORE }}" | base64 --decode > android/app/keystore.jks
# build Android APK with ABI splits
flutter build apk --release --split-per-abi
# build universal Android APK
flutter build apk --release
# 'bin' directory to store and upload the renamed APKs
mkdir bin
# Rename output APKs with Release Tag
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk bin/spectrum-${{ github.event.release.tag_name }}-app-arm64-v8a-release.apk
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk bin/spectrum-${{ github.event.release.tag_name }}-app-armeabi-v7a-release.apk
mv build/app/outputs/flutter-apk/app-x86_64-release.apk bin/spectrum-${{ github.event.release.tag_name }}-app-x86_64-release.apk
# Rename Universal APK with Release Tag
mv build/app/outputs/flutter-apk/app-release.apk bin/spectrum-${{ github.event.release.tag_name }}-app-universal.apk
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: bin/*.apk