Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 48 lines (40 sloc) 941 Bytes
#!/bin/sh
set -e
build() {
if [ -f Makefile ]; then
make clean all
else
stack build --pedantic --test
fi
}
if ! build; then
if [ "${FORCE:-0}" -eq 1 ]; then
{
echo
echo "WARNING: Build failure"
printf 'Proceeding anyway (FORCE=%s)\n' "$FORCE"
} >&2
else
exit 1
fi
fi
name=$(sed '/^name: *\(.*\)$/!d; s//\1/' ./*.cabal)
version=$(sed '/^version: *\(.*\)$/!d; s//\1/' ./*.cabal)
if [ -z "$version" ]; then
echo "No cabal file or version not found" >&2
exit 1
fi
if ! git show --no-patch --format=%B HEAD | grep -Fq 'Version bump'; then
{
echo "WARNING: last commit was not in common version bump format:"
git show --no-patch --format=%B HEAD
echo
} >&2
fi
printf 'Upload, tag, and push: %s-%s\n' "$name" "$version"
printf "Continue? [y/n] "
read -r ans
[ "$ans" != y ] && exit 1
stack upload .
git tag --sign --message "v$version" "v$version"
git push --follow-tags