Skip to content

Commit

Permalink
[CI] Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
proninyaroslav committed Oct 9, 2024
1 parent bb6fcd5 commit 720f033
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/flutter_release_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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 }}

0 comments on commit 720f033

Please sign in to comment.