This is useful when tagging releases within a monorepo. Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
21 lines
407 B
Nix
21 lines
407 B
Nix
{ git, writeShellApplication }:
|
|
|
|
writeShellApplication {
|
|
name = "tag-release";
|
|
|
|
runtimeInputs = [ git ];
|
|
|
|
text = ''
|
|
commit_sha="''${1:-HEAD}"
|
|
prefix="''${2:-}"
|
|
|
|
tag="$(date '+%Y%m%d%R%S' | sed "s/://g")"
|
|
|
|
test "$prefix" != "" && tag="$prefix/$tag"
|
|
|
|
echo "Tagging commit $(git rev-parse "''${commit_sha}") as ''${tag}."
|
|
echo ""
|
|
|
|
git tag "''${tag}" "''${commit_sha}"
|
|
'';
|
|
}
|