Created
September 28, 2018 10:47
-
-
Save achilles42/eddcae4be7bc76274d9f6e84d560f1d6 to your computer and use it in GitHub Desktop.
goreleaser for proctor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
TAR_FILE="/tmp/goreleaser.tar.gz" | |
RELEASES_URL="https://github.com/goreleaser/goreleaser/releases" | |
TMP_DIR="/tmp/" | |
last_version() { | |
curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" | | |
rev | | |
cut -f1 -d'/'| | |
rev | |
} | |
download() { | |
test -z "$VERSION" && VERSION="$(last_version)" | |
test -z "$VERSION" && { | |
echo "Unable to get goreleaser version." >&2 | |
exit 1 | |
} | |
rm -f "$TAR_FILE" | |
curl -s -L -o "$TAR_FILE" \ | |
"$RELEASES_URL/download/$VERSION/goreleaser_$(uname -s)_$(uname -m).tar.gz" | |
} | |
download | |
tar -xf "$TAR_FILE" -C "$TMPDIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment