Skip to content

Instantly share code, notes, and snippets.

@030
Last active November 9, 2022 14:03
Show Gist options
  • Save 030/620a95e7a699c4db3e76b2b8b0309909 to your computer and use it in GitHub Desktop.
Save 030/620a95e7a699c4db3e76b2b8b0309909 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
GITHUB_TAG="${GITHUB_TAG:-local}"
SHA512_CMD="${SHA512_CMD:-sha512sum}"
GO_BUILD_DIR="${1}"
GO_BUILD_DELIVERABLE="${2}"
echo "GITHUB_TAG: '${GITHUB_TAG}', SHA512_CMD: '${SHA512_CMD}', GO_BUILD_DIR: ${GO_BUILD_DIR}, GO_BUILD_DELIVERABLE: '${GO_BUILD_DELIVERABLE}'"
cd cmd/${GO_BUILD_DIR}
go build -buildvcs=false -ldflags "-X main.Version=${GITHUB_TAG}" -o "${GO_BUILD_DELIVERABLE}"
$SHA512_CMD "${GO_BUILD_DELIVERABLE}" >"${GO_BUILD_DELIVERABLE}.sha512.txt"
chmod +x "${GO_BUILD_DELIVERABLE}"
cd ../..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment