From 880437d5ad9aaa59c747e41667d0039c4d27b8c1 Mon Sep 17 00:00:00 2001 From: polybluez <163671824+polybluez@users.noreply.github.com> Date: Sat, 21 Dec 2024 15:53:24 +0000 Subject: [PATCH] Try to change modification time for assets and executables to respective commit dates --- .github/workflows/main.yml | 36 +++++++++++++++++++++++++++++++----- cross/mingw/default.nix | 30 +++++++++++++----------------- flake.nix | 5 ++++- 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 18d2ecd..cfe58a3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,16 +18,30 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - name: Enter shell with needed dependencies run: | - nix shell nixpkgs#jq nixpkgs#p7zip nixpkgs#git + nix shell --inputs-from . nixpkgs#jq nixpkgs#p7zip nixpkgs#git nixpkgs#findutils - name: Update Doom2D related inputs run: | nix flake update d2df-sdl d2df-editor doom2df-res + D2DF_REV=$(nix flake metadata . --json 2>/dev/null | jq --raw-output '.locks.nodes."d2df-sdl".locked.rev') EDITOR_REV=$(nix flake metadata . --json 2>/dev/null | jq --raw-output '.locks.nodes."d2df-editor".locked.rev') RES_REV=$(nix flake metadata . --json 2>/dev/null | jq --raw-output '.locks.nodes."doom2df-res".locked.rev') + + D2DF_PATH=$(nix eval '.#dfInputs' --json 2>/dev/null | jq '."x86_64-linux"."d2df-sdl"') + EDITOR_PATH=$(nix eval '.#dfInputs' --json 2>/dev/null | jq '."x86_64-linux"."d2df-editor"') + RES_PATH=$(nix eval '.#dfInputs' --json 2>/dev/null | jq '."x86_64-linux"."doom2df-res"') + + D2DF_LAST_COMMIT_DATE=$(git log --git-dir "$(D2DF_PATH)/.git" -1 --format="%ad" --date=iso) + EDITOR_LAST_COMMIT_DATE=$(git log --git-dir "$(EDITOR_PATH)/.git" -1 --format="%ad" --date=iso) + RES_LAST_COMMIT_DATE=$(git log --git-dir "$(RES_PATH)/.git" -1 --format="%ad" --date=iso) + echo "D2DF_REV=$D2DF_REV" >> "$GITHUB_ENV" - echo "RES_REV=$RES_REV" >> "$GITHUB_ENV" echo "EDITOR_REV=$RES_REV" >> "$GITHUB_ENV" + echo "RES_REV=$RES_REV" >> "$GITHUB_ENV" + echo "D2DF_LAST_COMMIT_DATE=$D2DF_LAST_COMMIT_DATE" >> "$GITHUB_ENV" + echo "EDITOR_LAST_COMMIT_DATE=$EDITOR_LAST_COMMIT_DATE" >> "$GITHUB_ENV" + echo "RES_LAST_COMMIT_DATE=$RES_LAST_COMMIT_DATE" >> "$GITHUB_ENV" + printf 'This build has the following inputs:\nd2df-sdl: %s\ndoom2d-res: %s\nd2df-editor: %s' $D2DF_REV $RES_REV $EDITOR_REV > release_body - name: Build debug APK run: | @@ -40,12 +54,24 @@ jobs: if-no-files-found: error - name: Build Windows 32-bit ZIP bundle run: | - nix build .#legacyPackages.x86_64-linux.mingw.byArch.mingw32.doom2df-bundle - 7z a -tzip doom2df-win32.zip -w result/. + mkdir -p doom2df-win32 build/assets build/bin + nix build .#legacyPackages.x86_64-linux.mingw.byArch.mingw32.gameAssetsPath + cp result/* build/assets/ + nix build .#legacyPackages.x86_64-linux.mingw.byArch.mingw32.gameExecutablePath + cp result/* build/bin/ + find . -type f -iname 'doom2df*' -exec touch -d ${{ env.D2DF_LAST_COMMIT_DATE }} {} \; + find . -type f -iname 'editor*' -exec touch -d ${{ env.EDITOR_LAST_COMMIT_DATE }} {} \; + find . -type f -exec touch -d ${{ env.RES_LAST_COMMIT_DATE }} {} \; + cp build/bin/* doom2df-win32 + cp build/assets/* doom2df-win32 + + rm -rf build + 7z a -mtm -stl -ssp -tzip doom2df-win32.zip -w doom2df-win32/. + rm doom2df-win32/ - uses: actions/upload-artifact@v4 with: name: doom2df-win32 - path: result + path: doom2df-win32.zip if-no-files-found: error - uses: ncipollo/release-action@v1 if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch'}} diff --git a/cross/mingw/default.nix b/cross/mingw/default.nix index 5cb8d51..1b1f126 100644 --- a/cross/mingw/default.nix +++ b/cross/mingw/default.nix @@ -195,24 +195,20 @@ buildAsLibrary = false; }; - doom2df-bundle = mkGamePath { - inherit gameAssetsPath; - gameExecutablePath = let - f = pkgs.callPackage mkExecutablePath { - byArchPkgsAttrs = { - mingw32 = { - sharedLibraries = [enet SDL2 fmodex]; - doom2df = doom2d; - editor = editor; - isWindows = true; - withEditor = true; - asLibrary = false; - prefix = "."; - }; - }; + inherit gameAssetsPath; + + gameExecutablePath = pkgs.callPackage mkExecutablePath { + byArchPkgsAttrs = { + mingw32 = { + sharedLibraries = [enet SDL2 fmodex]; + doom2df = doom2d; + editor = editor; + isWindows = true; + withEditor = true; + asLibrary = false; + prefix = "."; }; - in - f; + }; }; }; crossPkgs = lib.mapAttrs createCrossPkgSet architectures; diff --git a/flake.nix b/flake.nix index 3a1679d..d16eac2 100755 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ flake = false; }; }; - outputs = { + outputs = inputs @ { self, nixpkgs, flake-utils, @@ -88,6 +88,9 @@ botnames = ./game/assets/dirtyAssets/botnames.txt; }; in { + dfInputs = { + inherit d2df-sdl d2df-editor doom2df-res; + }; legacyPackages.android = (import ./packages/android.nix).default { inherit pkgs lib fpcPkgs d2dfPkgs d2df-sdl doom2df-res d2df-editor; androidRoot = assets.androidRoot;