Skip to content

Commit 493bafd

Browse files
committed
feat: append build number to version in CI workflow for APK, Windows, and iOS builds
1 parent 1b3266e commit 493bafd

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/flutter-ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ jobs:
160160
id: get_version
161161
run: |
162162
VERSION=$(grep '^version:' pubspec.yaml | head -n1 | awk '{print $2}' | cut -d'+' -f1)
163-
echo "version=$VERSION" >> $GITHUB_OUTPUT
163+
# append build number from previous job
164+
VERSION_PLUS="${VERSION}+${{ needs.get-build-number.outputs.build_number }}"
165+
echo "version=${VERSION_PLUS}" >> $GITHUB_OUTPUT
164166
165167
- name: Build APK
166168
run: flutter build apk --release --target-platform android-arm64 --build-number ${{ needs.get-build-number.outputs.build_number }}
@@ -234,7 +236,10 @@ jobs:
234236
id: get_version
235237
run: |
236238
$version = (Select-String -Path pubspec.yaml -Pattern '^version:' | Select-Object -First 1).Line.Split(':')[1].Trim().Split('+')[0]
237-
echo "version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
239+
# append build number from previous job
240+
$build = "${{ needs.get-build-number.outputs.build_number }}"
241+
$versionPlus = "${version}+${build}"
242+
echo "version=$versionPlus" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
238243
239244
- name: Build Windows executable
240245
run: flutter build windows --release --build-number ${{ needs.get-build-number.outputs.build_number }}
@@ -301,7 +306,8 @@ jobs:
301306
id: get_version
302307
run: |
303308
VERSION=$(grep '^version:' pubspec.yaml | head -n1 | awk '{print $2}' | cut -d'+' -f1)
304-
echo "version=$VERSION" >> $GITHUB_OUTPUT
309+
VERSION_PLUS="${VERSION}+${{ needs.get-build-number.outputs.build_number }}"
310+
echo "version=${VERSION_PLUS}" >> $GITHUB_OUTPUT
305311
306312
- name: Build iOS app (no codesign)
307313
run: flutter build ios --release --no-codesign --build-number ${{ needs.get-build-number.outputs.build_number }}

client/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1616
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
1717
# In Windows, build-name is used as the major, minor, and patch parts
1818
# of the product and file versions while build-number is used as the build suffix.
19-
version: 0.4.99-beta+0
19+
version: 0.5.0+0
2020

2121
workspace:
2222
- packages/lw_wot

0 commit comments

Comments
 (0)