diff --git a/SHA256SUMS b/SHA256SUMS index 623f0ac..0825257 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -1,2 +1,2 @@ 05e4977d541b2ef07c757acca912b7b58b379fb425eceb3a1f53c829a78a4aa4 docker2aci.sh -bbe234c06c8e718cdbc4330546060b137d6ebddec811a320a4eecdec36a2363b golang.sh +bb37ce911951a311e6ab4c27ddbc310d0f609556371be46a47656e70165034cf golang.sh diff --git a/golang.sh b/golang.sh index b167358..5766e2d 100755 --- a/golang.sh +++ b/golang.sh @@ -26,28 +26,28 @@ DRAFT=${DRAFT:-true} go version -step Retrieve dependencies +step "Retrieve dependencies" go get github.com/aktau/github-release go get github.com/mitchellh/gox -step Test code +step "Test code" go vet ${PACKAGES} go test ${PACKAGES} -step Cleanup build directory if present +step "Cleanup build directory if present" rm -rf ${BUILD_DIR} -step Compile program +step "Compile program" mkdir ${BUILD_DIR} gox -ldflags="-X main.version=${VERSION}" -osarch="${ARCHS}" \ -output="${BUILD_DIR}/{{.Dir}}_{{.OS}}_{{.Arch}}" \ ${PACKAGES} -step Generate binary SHASUMs +step "Generate binary SHASUMs" cd ${BUILD_DIR} sha256sum * >SHA256SUMS -step Packing archives +step "Packing archives" for file in *; do if [ "${file}" = "SHA256SUMS" ]; then continue @@ -62,12 +62,12 @@ for file in *; do rm "${file}" done -step Generate archive SHASUMs +step "Generate archive SHASUMs" sha256sum * >>SHA256SUMS grep -v 'SHA256SUMS' SHA256SUMS >SHA256SUMS.tmp mv SHA256SUMS.tmp SHA256SUMS -step Publish builds to Github +step "Publish builds to Github" if (test "${VERSION}" == "ghpublish__notags"); then echo "No tag present, stopping build now." @@ -79,10 +79,15 @@ if [ -z "${GITHUB_TOKEN}" ]; then exit 1 fi -step Create a drafted release -github-release release --user ${GHUSER} --repo ${REPO} --tag ${DEPLOYMENT_TAG} --name ${DEPLOYMENT_TAG} --draft=${DRAFT} || true +if [[ "${DRAFT}" == "true" ]]; then + step "Create a drafted release" + github-release release --user ${GHUSER} --repo ${REPO} --tag ${DEPLOYMENT_TAG} --name ${DEPLOYMENT_TAG} --draft || true +else + step "Create a published release" + github-release release --user ${GHUSER} --repo ${REPO} --tag ${DEPLOYMENT_TAG} --name ${DEPLOYMENT_TAG} || true +fi -step Upload build assets +step "Upload build assets" for file in *; do echo "- ${file}" github-release upload --user ${GHUSER} --repo ${REPO} --tag ${DEPLOYMENT_TAG} --name ${file} --file ${file}