From a63d182c5078cd879a90b577ebec806ea83f1ded Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Thu, 1 Oct 2026 16:15:36 -0400 Subject: [PATCH] show git commit in about dialog --- .github/workflows/android.yml | 60 +++++++++---------- .github/workflows/ios.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/windows.yml | 2 +- lib/helpers/extensions/show_about_dialog.dart | 4 +- linux/nix/default.nix | 1 + linux/nix/pkg/default.nix | 5 ++ 7 files changed, 42 insertions(+), 34 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index a3abae1..b9b6207 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,39 +1,39 @@ name: "Build APK" on: - push: - branches: ["main"] - tags: ["*"] - workflow_dispatch: + push: + branches: ["main"] + tags: ["*"] + workflow_dispatch: jobs: - build-apk: - runs-on: ubuntu-latest + build-apk: + runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v6 - with: - submodules: recursive + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + submodules: recursive - - name: Lix GHA Installer Action - uses: samueldr/lix-gha-installer-action@v2026-02-22 - with: - extra_nix_config: experimental-features = nix-command flakes flake-self-attrs - - - name: Decode keystore - run: echo "$KEYSTORE_CONTENT" | base64 --decode > keystore.jks - env: - KEYSTORE_CONTENT: ${{ secrets.KEYSTORE_CONTENT }} + - name: Lix GHA Installer Action + uses: samueldr/lix-gha-installer-action@v2026-02-22 + with: + extra_nix_config: experimental-features = nix-command flakes flake-self-attrs - - name: Build app - run: nix develop --command bash -c "flutter pub get && dart scripts/generate.dart && flutter pub run build_runner build && flutter build apk --target-platform android-arm64" - env: - KEYSTORE_PATH: ../../keystore.jks - KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} + - name: Decode keystore + run: echo "$KEYSTORE_CONTENT" | base64 --decode > keystore.jks + env: + KEYSTORE_CONTENT: ${{ secrets.KEYSTORE_CONTENT }} - - name: Upload installer artifact - uses: actions/upload-artifact@v6 - with: - name: APK - path: build/app/outputs/flutter-apk/app-release.apk \ No newline at end of file + - name: Build app + run: nix develop --command bash -c "flutter pub get && dart scripts/generate.dart && flutter pub run build_runner build && flutter build apk --target-platform android-arm64 --dart-define=GIT_COMMIT=${{ github.sha }}" + env: + KEYSTORE_PATH: ../../keystore.jks + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} + + - name: Upload installer artifact + uses: actions/upload-artifact@v6 + with: + name: APK + path: build/app/outputs/flutter-apk/app-release.apk diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index eeb4868..28344ea 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -31,7 +31,7 @@ jobs: flutter pub get dart scripts/generate.dart flutter pub run build_runner build - flutter build ios --release --no-codesign + flutter build ios --no-codesign --dart-define=GIT_COMMIT=${{ github.sha }} # Unsigned IPA: SideStore/AltStore re-sign this on-device with the # user's own Apple ID at install time, so no certificate is needed here. diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 45d04d7..b56f16f 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -31,7 +31,7 @@ jobs: flutter pub get dart scripts/generate.dart flutter pub run build_runner build - flutter build macos --release + flutter build macos --dart-define=GIT_COMMIT=${{ github.sha }} - name: Create DMG id: create-dmg diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 036eea7..db339b9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -43,7 +43,7 @@ jobs: flutter pub get dart scripts/generate.dart flutter pub run build_runner build - flutter build windows --release + flutter build windows --dart-define=GIT_COMMIT=${{ github.sha }} - name: Copy MinGW runtime DLLs shell: msys2 {0} diff --git a/lib/helpers/extensions/show_about_dialog.dart b/lib/helpers/extensions/show_about_dialog.dart index 6ccba4c..4729e99 100644 --- a/lib/helpers/extensions/show_about_dialog.dart +++ b/lib/helpers/extensions/show_about_dialog.dart @@ -33,7 +33,9 @@ extension ShowAboutDialog on BuildContext { "Nexus", style: Theme.of(context).textTheme.headlineMedium, ), - Text("(${packageInfo.version})"), + Text( + "(${packageInfo.version}+${const String.fromEnvironment("GIT_COMMIT", defaultValue: "dev")})", + ), ], ), diff --git a/linux/nix/default.nix b/linux/nix/default.nix index 2af57aa..3c0a301 100644 --- a/linux/nix/default.nix +++ b/linux/nix/default.nix @@ -20,6 +20,7 @@ let default = pkgs.callPackage ./pkg { src = self; + commit = self.shortRev or self.dirtyShortRev; }; in { diff --git a/linux/nix/pkg/default.nix b/linux/nix/pkg/default.nix index 7a2a979..e2e6d3e 100644 --- a/linux/nix/pkg/default.nix +++ b/linux/nix/pkg/default.nix @@ -6,6 +6,7 @@ libclang, flutter, src, + commit ? "dev", }: flutter.buildFlutterApplication { @@ -19,6 +20,10 @@ flutter.buildFlutterApplication { packageRun build_runner build ''; + flutterBuildFlags = [ + "--dart-define=GIT_COMMIT=${commit}" + ]; + buildInputs = [ mpv-unwrapped libass