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:"
|
2022-12-29 10:55:31 +03:00
|
|
|
git tag | sort -V | tail
|
2019-08-04 20:07:14 +03:00
|
|
|
|
|
|
|
# ... 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-12-29 10:56:35 +03:00
|
|
|
if ! echo "${VERSION}" | grep -q -E '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
|
|
echo "ERROR: Version number must be on the form: v1.2.3: ${VERSION}"
|
2021-04-20 21:31:23 +03:00
|
|
|
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:"
|
2022-12-29 10:56:35 +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
|
2022-12-29 10:56:35 +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
|
2023-02-22 21:48:31 +03:00
|
|
|
GOOS=linux GOARCH=arm ./build.sh # Ref: https://github.com/walles/moar/issues/122
|
2019-08-04 20:07:14 +03:00
|
|
|
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
|
2022-12-29 10:56:35 +03:00
|
|
|
echo "Please upload the following binaries to <https://github.com/walles/moar/releases/tag/${VERSION}>:"
|
|
|
|
file releases/moar-"${VERSION}"-*-*
|