Skip to content

Flutter Release Build CI #3

Flutter Release Build CI

Flutter Release Build CI #3

name: Flutter Release Build CI
on:
release:
types: [prereleased]
permissions:
contents: write
env:
FLUTTER_VERSION: "3.24.3"
jobs:
build-android-debug:
runs-on: ubuntu-latest
env:
APK_NAME: Blink_Comparison-${{ github.event.release.tag_name }}-debug.apk
outputs:
versionNum: ${{ steps.apk-info.outputs.versionNum }}
versionCode: ${{ steps.apk-info.outputs.versionCode }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Disable Google Analytics
run: flutter config --no-analytics
- name: Install dependencies
run: flutter pub get
- name: Build debug Android APK
id: build
run: |
flutter build apk --flavor base --debug
cd build/app/outputs/flutter-apk/
mv app-base-debug.apk "$APK_NAME"
echo "assets-path=build/app/outputs/flutter-apk" >> "$GITHUB_OUTPUT"
- name: Extract APK version code
id: apk-info
uses: 8Mi-Tech/get-apk-info-action@master
with:
apkPath: ${{ steps.build.outputs.assets-path }}/${{ env.APK_NAME }}
generate-metadata-assets:
runs-on: ubuntu-latest
needs: [build-android-debug]
env:
VERSION_FILE: version.txt
steps:
- uses: actions/checkout@v4
- name: Create assests
env:
ANDROID_BUILD_NAME: ${{ needs.build-android-debug.outputs.versionNum }}
ANDROID_BUILD_NUMBER: ${{ needs.build-android-debug.outputs.versionCode }}
run: |
echo "android-build-name=$ANDROID_BUILD_NAME" >> $VERSION_FILE
echo "android-build-number=$ANDROID_BUILD_NUMBER" >> $VERSION_FILE
- name: Upload assets
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
prerelease: true
files: |
${{ env.VERSION_FILE }}