Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new install anf run script (#3075)
* feat: new install anf run script - move away from deprecated git.io - support distribution - verify checksums and signature closes #3074 Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: rename script Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
- Loading branch information
Showing
7 changed files
with
81 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if test "$DISTRIBUTION" = "pro"; then | ||
echo "Using Pro distribution..." | ||
RELEASES_URL="https://github.com/goreleaser/goreleaser-pro/releases" | ||
FILE_BASENAME="goreleaser-pro" | ||
else | ||
echo "Using the OSS distribution..." | ||
RELEASES_URL="https://github.com/goreleaser/goreleaser/releases" | ||
FILE_BASENAME="goreleaser" | ||
fi | ||
|
||
test -z "$VERSION" && VERSION="$(curl -sfL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" | | ||
rev | | ||
cut -f1 -d'/'| | ||
rev)" | ||
|
||
test -z "$VERSION" && { | ||
echo "Unable to get goreleaser version." >&2 | ||
exit 1 | ||
} | ||
|
||
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)" | ||
export TAR_FILE="$TMPDIR/${FILE_BASENAME}_$(uname -s)_$(uname -m).tar.gz" | ||
|
||
( | ||
cd "$TMPDIR" | ||
echo "Downloading GoReleaser $VERSION..." | ||
curl -sfLo "$TAR_FILE" \ | ||
"$RELEASES_URL/download/$VERSION/${FILE_BASENAME}_$(uname -s)_$(uname -m).tar.gz" | ||
curl -sfLo "checksums.txt" "$RELEASES_URL/download/$VERSION/checksums.txt" | ||
curl -sfLo "checksums.txt.sig" "$RELEASES_URL/download/$VERSION/checksums.txt.sig" | ||
echo "Verifying checksums..." | ||
sha256sum --ignore-missing --quiet --check checksums.txt | ||
if command -v cosign >/dev/null 2>&1; then | ||
echo "Verifying signatures..." | ||
COSIGN_EXPERIMENTAL=1 cosign verify-blob \ | ||
--signature checksums.txt.sig \ | ||
checksums.txt | ||
else | ||
echo "Could not verify signatures, cosign is not installed." | ||
fi | ||
) | ||
|
||
tar -xf "$TAR_FILE" -C "$TMPDIR" | ||
"${TMPDIR}/goreleaser" "$@" | ||
|