From b83e3d6be9ca04bc4a5a89bccf8e522bebcb4d56 Mon Sep 17 00:00:00 2001 From: Valentin REVERSAT Date: Sun, 21 Apr 2024 15:21:53 +0200 Subject: [PATCH] chore(build): modify the build step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The build step now use ´--build-name´ param to dynamically set the app version without editing the pubspec.yaml file --- .github/workflows/action.flutter.build.yaml | 26 ++++++++++++--------- pubspec.yaml | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/action.flutter.build.yaml b/.github/workflows/action.flutter.build.yaml index f27681e0..675729fc 100644 --- a/.github/workflows/action.flutter.build.yaml +++ b/.github/workflows/action.flutter.build.yaml @@ -18,7 +18,7 @@ on: jobs: - build_android: + Android: name: 'Android (${{ inputs.android_output }})' runs-on: ubuntu-latest steps: @@ -41,28 +41,32 @@ jobs: uses: subosito/flutter-action@v2.16.0 with: flutter-version: ${{ inputs.flutter_version }} + - name: 'Generate build number' + run: | + BUILD_NUMBER=$(git rev-list --all --count) + echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV + echo "This build is tagged as $BUILD_NAME+$BUILD_NUMBER on $GITHUB_REF" + env: + BUILD_NAME: ${{ github.ref_name }} - name: 'Build Android APK' if: ${{ inputs.android_output == 'apk' }} - # Build APK version of the app - run: flutter build apk --split-per-abi + run: flutter build apk --build-name="$BUILD_NAME" --build-number="$BUILD_NUMBER" --split-per-abi + env: + BUILD_NUMBER: ${{ env.BUILD_NUMBER }} + BUILD_NAME: ${{ github.ref_name }} + ENV: ${{ inputs.env }} - name: 'Save APK' if: ${{ inputs.android_output == 'apk' }} uses: actions/upload-artifact@v4 with: name: 'apk-build' path: build/app/outputs/apk/release/app-arm64-v8a-release.apk - - name: 'Generate build number' - if: ${{ inputs.android_output == 'aab' }} - # Build App Bundle version of the app - run: | - BUILD_NUMBER=$(git rev-list --all --count) - echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV - echo "This build is tagged as $BUILD_NUMBER on $GITHUB_REF" - name: 'Build Android App Bundle' if: ${{ inputs.android_output == 'aab' }} - run: flutter build appbundle --build-number="$BUILD_NUMBER" --dart-define=SENTRY_DSN="$SENTRY_DSN" --dart-define=ENV="$ENV" + run: flutter build appbundle --build-name="$BUILD_NAME" --build-number="$BUILD_NUMBER" --dart-define=SENTRY_DSN="$SENTRY_DSN" --dart-define=ENV="$ENV" env: BUILD_NUMBER: ${{ env.BUILD_NUMBER }} + BUILD_NAME: ${{ github.ref_name }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }} ENV: ${{ inputs.env }} - name: 'Save AAB' diff --git a/pubspec.yaml b/pubspec.yaml index 73515953..e37678d2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: Mobile app to get the closing and opening schedules of the Chaban D publish_to: 'none' -version: 2.5.3 +version: 0.0.0-dev environment: sdk: '>=3.0.0 <4.0.0'