From cd7a41c23c2a357dddea623863d753254a16150f Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Thu, 22 May 2025 17:15:33 +0100 Subject: [PATCH] update-scripts/update: write version-info during update --- update-scripts/update.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/update-scripts/update.nix b/update-scripts/update.nix index 96883cd2..c4900aa1 100644 --- a/update-scripts/update.nix +++ b/update-scripts/update.nix @@ -41,12 +41,29 @@ writeShellApplication { fi } + versionInfo() { + nix-build ./update-scripts -A version-info + install -m 644 -T "$(realpath result)" ./version-info.toml + if [ -n "$commit" ]; then + git add version-info.toml + git commit "$@" + fi + } + + # Initialise version-info.toml + if [ ! -f version-info.toml ]; then + echo "Creating version-info file" + versionInfo -m "version-info: init" + fi + # Update the root lockfile old=$(git show --no-patch --format=%h) echo "Updating root lockfile" nix flake update "''${update_args[@]}" new=$(git show --no-patch --format=%h) if [ "$old" != "$new" ]; then + echo "Updating version-info" + versionInfo --amend --no-edit writeGitHubOutput root_lock_body fi @@ -59,6 +76,8 @@ writeShellApplication { --flake './flake/dev' new=$(git show --no-patch --format=%h) if [ "$old" != "$new" ]; then + echo "Updating version-info" + versionInfo --amend --no-edit writeGitHubOutput dev_lock_body fi '';