Skip to content

Commit db9ffd6

Browse files
committed
修改工作流,更新版本号
1 parent 274ae49 commit db9ffd6

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,30 @@ jobs:
5959
run: |
6060
ls -l android/app/google-services.json || echo "google-services.json NOT FOUND"
6161
ls -l lib/firebase_options.dart || echo "firebase_options.dart NOT FOUND"
62+
63+
- name: Resolve Build Version
64+
id: version
65+
run: |
66+
python3 - <<'PY' >> $GITHUB_OUTPUT
67+
import re
68+
from pathlib import Path
69+
content = Path("pubspec.yaml").read_text(encoding="utf-8")
70+
match = re.search(r"^version:\s*([0-9A-Za-z\.\-]+)\+(\d+)\s*$", content, re.M)
71+
if not match:
72+
raise SystemExit("pubspec.yaml missing version like x.y.z+N")
73+
build_name = match.group(1)
74+
build_number = int(match.group(2)) + 1
75+
print(f"build_name={build_name}")
76+
print(f"build_number={build_number}")
77+
PY
6278
6379
- name: Build Fat APK (Universal)
6480
run: |
65-
flutter build apk --release
81+
flutter build apk --release --build-name ${{ steps.version.outputs.build_name }} --build-number ${{ steps.version.outputs.build_number }}
6682
mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/CQUT-Helper-universal.apk
6783
6884
- name: Build Split APKs
69-
run: flutter build apk --release --split-per-abi
85+
run: flutter build apk --release --split-per-abi --build-name ${{ steps.version.outputs.build_name }} --build-number ${{ steps.version.outputs.build_number }}
7086

7187
- name: Create Release
7288
uses: softprops/action-gh-release@v1

.metadata

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ migration:
1818
- platform: android
1919
create_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
2020
base_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
21-
- platform: ios
22-
create_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
23-
base_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
24-
- platform: web
25-
create_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
26-
base_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
2721

2822
# User provided section
2923

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.2.0+1
19+
version: 0.2.1+1
2020

2121
environment:
2222
sdk: ^3.9.2

0 commit comments

Comments
 (0)