diff --git a/scripts/release.sh b/scripts/release.sh index 8a2703b..6f41f96 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,10 +1,20 @@ #!/usr/bin/env bash # inspired from git-cliff + +untracked_files=$(git ls-files . --exclude-standard --others) + +# check for untracked files +if [ -n "$untracked_files" ]; then + echo "warn: Please stash or remove the untracked files" + exit 1 +fi + + # takes the tag as an argument (e.g. v0.1.0) if [ -n "$1" ]; then # update the version - sed "0,/^version = .*$/s//version = \"${1#v}\"/" -i Cargo.toml + sed "0,/^version = .*$/s//version = \"${1#v}\"/" -i Cargo.toml # update the changelog git-cliff --tag "$1" > CHANGELOG.md git add -A && git commit -m "$1" @@ -13,4 +23,5 @@ if [ -n "$1" ]; then git tag -v "$1" else echo "warn: Please provide a tag" + exit 1 fi