Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-03 16:15:53 +08:00
parent 1b213793d4
commit ec37af5900
3 changed files with 8 additions and 5 deletions

View File

@@ -67,7 +67,7 @@ jobs:
- name: flutter build apk - name: flutter build apk
run: | run: |
chmod +x lib/scripts/build.dart chmod +x lib/scripts/build.dart
dart lib/scripts/build.dart "true" dart lib/scripts/build.dart "android"
flutter build apk --release --split-per-abi flutter build apk --release --split-per-abi
- name: 上传 - name: 上传

4
.vscode/tasks.json vendored
View File

@@ -3,7 +3,7 @@
"tasks": [ "tasks": [
{ {
"label": "Update build_config", "label": "Update build_config",
"command": "dart lib/scripts/build.dart", "command": "dart lib/scripts/build.dart dev",
"type": "shell", "type": "shell",
"problemMatcher": [], "problemMatcher": [],
"presentation": { "presentation": {
@@ -13,7 +13,7 @@
}, },
{ {
"label": "Update build_config (FVM)", "label": "Update build_config (FVM)",
"command": "fvm dart lib/scripts/build.dart", "command": "fvm dart lib/scripts/build.dart dev",
"type": "shell", "type": "shell",
"problemMatcher": [], "problemMatcher": [],
"presentation": { "presentation": {

View File

@@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
void main(Iterable<String> args) async { void main(Iterable<String> args) async {
final arg = args.firstOrNull;
final pubspecFile = File('pubspec.yaml'); final pubspecFile = File('pubspec.yaml');
final lines = await pubspecFile.readAsLines(); final lines = await pubspecFile.readAsLines();
@@ -18,7 +19,7 @@ void main(Iterable<String> args) async {
'HEAD', 'HEAD',
])).stdout.toString().trim(); ])).stdout.toString().trim();
if (args.isNotEmpty) { if (arg == 'android') {
versionName += '-${commitHash.substring(0, 9)}'; versionName += '-${commitHash.substring(0, 9)}';
} }
@@ -43,6 +44,8 @@ class BuildConfig {
} }
'''; ''';
if (arg != 'dev') {
pubspecFile.writeAsString(lines.join('\n')); pubspecFile.writeAsString(lines.join('\n'));
}
File('lib/build_config.dart').writeAsString(content); File('lib/build_config.dart').writeAsString(content);
} }