chore: use version.txt rather than modifying source code on bump

Signed-off-by: Juan C. Müller <me@juancmuller.com>
This commit is contained in:
Juan C. Müller 2025-04-10 20:29:25 -04:00
parent 44a904c668
commit 16eda61926
No known key found for this signature in database
GPG key ID: F44EA51A28F9B4A7
3 changed files with 18 additions and 15 deletions

View file

@ -1,7 +1,7 @@
{pkgs ? import <nixpkgs> {}, ...}:
pkgs.buildGoModule {
pname = "ess";
version = "2.16.4";
version = pkgs.lib.strings.removeSuffix "\n" (builtins.readFile ./version.txt);
src = ./.;
vendorHash = null;

View file

@ -45,17 +45,19 @@
scripts = {
prepare-release = {
description = "prepare a release";
exec = ''
exec =
# bash
''
git config --global user.email 'actions@github.com'
git config --global user.name 'Github Actions'
OLD_TAG=$(svu current | sed 's/^v//g')
NEW_TAG=$(svu next | sed 's/^v//g')
[ "$OLD_TAG" == "$NEW_TAG" ] && echo "no version bump" && exit 0
echo default.nix README.md | xargs sed -i "s/$OLD_TAG/$NEW_TAG/g"
echo default.nix README.md | xargs sed -i "s/v$OLD_TAG/v$NEW_TAG/g"
git add default.nix README.md
OLD_VERSION=$(svu current --tag.prefix "")
NEW_VERSION=$(svu next --tag.prefix "" --always)
[ "$OLD_VERSION" == "$NEW_VERSION" ] && echo "no version bump" && exit 0
sed -i "s/$OLD_VERSION/$NEW_VERSION/g" README.md
echo "$NEW_VERSION" >version.txt
git add version.txt README.md
git commit -m "bump release version" --allow-empty
git tag v$NEW_TAG
git tag v$NEW_VERSION
git push
git push --tags
'';

1
version.txt Normal file
View file

@ -0,0 +1 @@
2.16.4