1
1
mirror of https://github.com/walles/moar.git synced 2024-12-02 09:15:46 +03:00
moar/release.sh

63 lines
1.7 KiB
Bash
Raw Normal View History

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:"
git tag | sort -V | tail
2019-08-04 20:07:14 +03:00
# ... and ask for a new version number.
echo
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
# 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}"
exit 1
fi
# 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.*//'
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
# 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=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
GOOS=windows GOARCH=amd64 ./build.sh
2019-08-04 20:07:14 +03:00
# Push the newly built release tag
git push --tags
# 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}"-*-*