Skip to content

Commit

Permalink
build: fails the release script if untracked files exists
Browse files Browse the repository at this point in the history
  • Loading branch information
azzamsa committed Nov 30, 2021
1 parent c79cd2d commit 2a5b5a6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -13,4 +23,5 @@ if [ -n "$1" ]; then
git tag -v "$1"
else
echo "warn: Please provide a tag"
exit 1
fi

0 comments on commit 2a5b5a6

Please sign in to comment.