Skip to content

Commit

Permalink
chore(build): modify the build step
Browse files Browse the repository at this point in the history
The build step now use ´--build-name´ param to dynamically set the app version without editing the pubspec.yaml file
  • Loading branch information
vareversat committed Apr 21, 2024
1 parent 048ba18 commit b83e3d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/action.flutter.build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:


jobs:
build_android:
Android:
name: 'Android (${{ inputs.android_output }})'
runs-on: ubuntu-latest
steps:
Expand All @@ -41,28 +41,32 @@ jobs:
uses: subosito/[email protected]
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'
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit b83e3d6

Please sign in to comment.