2019-08-04 20:07:14 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e -o pipefail
|
|
|
|
|
2019-08-05 08:30:24 +03:00
|
|
|
echo "Running tests before making the release..."
|
2019-08-04 20:07:14 +03:00
|
|
|
./test.sh
|
|
|
|
|
2019-08-04 20:40:58 +03:00
|
|
|
# Bail if we're on a dirty version
|
|
|
|
if [ -n "$(git diff --stat)" ]; then
|
|
|
|
echo "ERROR: Please commit all changes before doing a release"
|
|
|
|
echo
|
|
|
|
git status
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-08-04 20:07:14 +03:00
|
|
|
|
|
|
|
# List existing version numbers...
|
|
|
|
echo
|
2019-08-05 08:30:24 +03:00
|
|
|
echo "Previous version numbers:"
|
2019-08-04 20:07:14 +03:00
|
|
|
git tag | cat
|
|
|
|
|
|
|
|
# ... and ask for a new version number.
|
|
|
|
echo
|
2021-04-20 21:31:23 +03:00
|
|
|
echo "Please provide a version number on the form 'v1.2.3' for the new release:"
|
2019-08-04 20:07:14 +03:00
|
|
|
read -r VERSION
|
|
|
|
|
2021-04-20 21:31:23 +03:00
|
|
|
# https://github.com/walles/moar/issues/47
|
2022-09-25 09:40:40 +03:00
|
|
|
if ! echo "$VERSION" | grep -q -E '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
|
2021-04-20 21:31:23 +03:00
|
|
|
echo "ERROR: Version number must be on the form: v1.2.3: $VERSION"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-08-08 18:59:04 +03:00
|
|
|
# List changes since last release as inspiration...
|
|
|
|
LAST_VERSION="$(git describe --abbrev=0)"
|
|
|
|
echo
|
|
|
|
|
|
|
|
# FIXME: Make this part of the editable tagging message
|
|
|
|
echo "Changes since last release:"
|
2019-11-19 17:36:21 +03:00
|
|
|
git log --first-parent --pretty="format:* %s" "$LAST_VERSION"..HEAD | sed 's/ diff.*//'
|
2019-11-13 18:26:08 +03:00
|
|
|
echo
|
|
|
|
echo
|
2019-08-04 20:07:14 +03:00
|
|
|
|
|
|
|
# Make an annotated tag for this release
|
2019-08-04 20:45:20 +03:00
|
|
|
git tag --annotate "$VERSION"
|
2019-08-04 20:07:14 +03:00
|
|
|
|
2021-06-05 12:10:31 +03:00
|
|
|
# NOTE: To get the version number right, these builds must be done after the
|
|
|
|
# above tagging.
|
2019-08-04 20:07:14 +03:00
|
|
|
#
|
|
|
|
# NOTE: Make sure this list matches the one in test.sh
|
|
|
|
GOOS=linux GOARCH=386 ./build.sh
|
|
|
|
GOOS=darwin GOARCH=amd64 ./build.sh
|
2021-09-10 07:50:44 +03:00
|
|
|
GOOS=windows GOARCH=amd64 ./build.sh
|
2019-08-04 20:07:14 +03:00
|
|
|
|
|
|
|
# Push the newly built release tag
|
|
|
|
git push --tags
|
|
|
|
|
2021-06-05 12:10:31 +03:00
|
|
|
# FIXME: Instead of asking the user to upload the binaries, upload them for
|
|
|
|
# the user.
|
2019-08-04 20:07:14 +03:00
|
|
|
echo
|
2019-08-04 20:44:00 +03:00
|
|
|
echo "Please upload the following binaries to <https://github.com/walles/moar/releases/tag/$VERSION>:"
|
2020-12-30 19:40:27 +03:00
|
|
|
file releases/moar-"$VERSION"-*-*
|
2021-06-05 12:10:31 +03:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Also, update the brew packaging by making a PR to this file:"
|
2021-06-12 09:47:24 +03:00
|
|
|
echo "https://github.com/Homebrew/homebrew-core/blob/master/Formula/moar.rb"
|
2022-02-13 09:57:40 +03:00
|
|
|
echo
|
2022-09-25 09:40:40 +03:00
|
|
|
echo "brew bump-formula-pr --url=https://github.com/walles/moar/archive/refs/tags/$VERSION.tar.gz moar"
|