1
1
mirror of https://github.com/walles/moar.git synced 2024-08-16 23:40:35 +03:00

Add a script for making new releases

This commit is contained in:
Johan Walles 2019-08-04 19:07:14 +02:00
parent eab564a705
commit bc4bae3625
5 changed files with 49 additions and 2 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/moar
/moar-*-*-*

View File

@ -84,7 +84,7 @@ Install (into `/usr/local/bin`) from source:
Making a new Release
--------------------
FIXME: Go release instructions
Execute `release.sh` and follow instructions.
TODO
----

View File

@ -2,9 +2,14 @@
VERSION="$(git describe --tags --dirty)"
BINARY="moar"
if [ -n "$GOOS$GOARCH" ] ; then
BINARY="$BINARY-$VERSION-$GOOS-$GOARCH"
fi
# Linker flags trick below from here:
# https://www.reddit.com/r/golang/comments/4cpi2y/question_where_to_keep_the_version_number_of_a_go/d1kbap7?utm_source=share&utm_medium=web2x
# This line must be last in the script so that its return code
# propagates properly to its caller
go build -ldflags="-X main.versionString=$VERSION"
go build -ldflags="-X main.versionString=$VERSION" -o "$BINARY"

40
release.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
set -e -o pipefail
./test.sh
# FIXME: Bail if we're on a dirty version
# List existing version numbers...
echo
git tag | cat
# ... and ask for a new version number.
echo
echo "Please provide a version number for the new release:"
read -r VERSION
# FIXME: When asking for a release description, list
# changes since last release as inspiration
# Make an annotated tag for this release
git tag --annotated "$VERSION"
# NOTE: To get the version number right, these builds must
# be done after the above tagging.
#
# NOTE: Make sure this list matches the one in test.sh
GOOS=linux GOARCH=386 ./build.sh
GOOS=darwin GOARCH=amd64 ./build.sh
# Push the newly built release tag
git push --tags
# FIXME: Put the actual URL here, don't just refer to Github
#
# FIXME: Instead of asking the user to upload the binaries,
# upload them for the user.
echo
echo "Please upload the following binaries to the new release page on Github:"
find . -maxdepth 1 -name 'moar-*-*-*' -print0 | xargs -0 -n1 basename

View File

@ -6,6 +6,7 @@ set -e -o pipefail
go test github.com/walles/moar/m
# Ensure we can cross compile
# NOTE: Make sure this list matches the one in release.sh
GOOS=linux GOARCH=386 ./build.sh
GOOS=darwin GOARCH=amd64 ./build.sh