update-scripts/update: write version-info during update

This commit is contained in:
Matt Sturgeon 2025-05-22 17:15:33 +01:00
parent 132c1611f6
commit cd7a41c23c
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -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
'';