add release util script
This commit is contained in:
parent
d3ef02cdbf
commit
53ab6b80ef
@ -32,6 +32,7 @@ rec {
|
||||
inherit system;
|
||||
program = "${default}/bin/${default.pname}";
|
||||
};
|
||||
updateRelease = writeScriptBin "update-release" (builtins.readFile ./utils/update-release.sh);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
40
utils/update-release.sh
Normal file
40
utils/update-release.sh
Normal file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
execute() {
|
||||
if [ "$dry_run" == "1" ]; then
|
||||
echo "Dry run: $*"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
dry_run=0
|
||||
[ "$1" == "--dry-run" ] && dry_run=1
|
||||
|
||||
read -p "Enter new version number: " new_version
|
||||
|
||||
execute sed -i "s/version = \"[0-9.]*\"/version = \"$new_version\"/" src/setup.py
|
||||
execute sed -i "s/version = \"[0-9.]*\";/version = \"$new_version\";/" flake.nix
|
||||
|
||||
git diff
|
||||
|
||||
read -p "Confirm changes and continue? (y/n): " confirm
|
||||
[ "$confirm" != "y" ] && echo "Aborting." && exit 1
|
||||
|
||||
execute git add src/setup.py flake.nix
|
||||
|
||||
git diff --cached
|
||||
|
||||
read -p "Confirm commit and continue? (y/n): " confirm_commit
|
||||
[ "$confirm_commit" != "y" ] && echo "Aborting." && git reset && exit 1
|
||||
|
||||
execute git commit -m "Bump version to $new_version"
|
||||
execute git tag "v$new_version"
|
||||
|
||||
read -p "Push changes and tag to remote? (y/n): " confirm_push
|
||||
[ "$confirm_push" != "y" ] && echo "Aborting." && exit 1
|
||||
|
||||
execute git push origin master
|
||||
execute git push origin "v$new_version"
|
||||
|
||||
echo "Done!"
|
||||
Loading…
x
Reference in New Issue
Block a user