feat(about): show compiled short Git commit

This commit is contained in:
zarzet
2026-09-06 14:54:35 +07:00
parent 8daae638f6
commit 4b7e731474
5 changed files with 18 additions and 3 deletions
+2 -1
View File
@@ -279,7 +279,8 @@ jobs:
- name: Build iOS (unsigned)
run: |
# Build Flutter iOS without codesigning
flutter build ios --release --no-codesign --config-only
flutter build ios --release --no-codesign --config-only \
--dart-define="GIT_COMMIT=$(git rev-parse --short=8 HEAD)"
# Use xcodebuild with code signing disabled
cd ios
+6 -1
View File
@@ -73,12 +73,17 @@ exact Flutter version declared in `.fvmrc` and replace `fvm flutter` with
4. Run the app:
```bash
fvm flutter run
fvm flutter run --dart-define="GIT_COMMIT=$(git rev-parse --short=8 HEAD)"
```
For iOS, run `scripts/build_ios.sh` on macOS before opening
`ios/Runner.xcworkspace`.
The About footer shows the short commit supplied through `GIT_COMMIT` at
compile time. The Android build script and iOS release workflow supply it
automatically. Include the same `--dart-define` when running Flutter build
commands directly; without it, the footer shows only the copyright.
## Project Boundaries
```text
+4
View File
@@ -5,6 +5,10 @@ class AppInfo {
static const String buildNumber = '143';
static const String fullVersion = '$version+$buildNumber';
static const String gitCommit = String.fromEnvironment('GIT_COMMIT');
static String get shortGitCommit =>
gitCommit.length > 8 ? gitCommit.substring(0, 8) : gitCommit;
static String get displayVersion => kDebugMode ? 'Internal' : version;
static const String appName = 'SpotiFLAC Mobile';
+4 -1
View File
@@ -223,7 +223,10 @@ class AboutPage extends StatelessWidget {
padding: const EdgeInsets.all(24),
child: Center(
child: Text(
AppInfo.copyright,
AppInfo.shortGitCommit.isEmpty
? AppInfo.copyright
: '${AppInfo.copyright} · ${AppInfo.shortGitCommit}',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: colorScheme.onSurfaceVariant,
),
+2
View File
@@ -8,10 +8,12 @@ PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
OUTPUT_DIR="$PROJECT_DIR/build/app/outputs/flutter-apk"
cd "$PROJECT_DIR"
BUILD_GIT_COMMIT="$(git rev-parse --short=8 HEAD)"
flutter build apk \
--release \
--split-per-abi \
--target-platform android-arm,android-arm64 \
--dart-define="GIT_COMMIT=$BUILD_GIT_COMMIT" \
"$@"
for apk in app-armeabi-v7a-release.apk app-arm64-v8a-release.apk; do