From 85dedf1aea0b9ed157625d4ff23a27993ca607d0 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 2 Aug 2021 03:37:31 +0200 Subject: [PATCH] Create checksums for artifacts Signed-off-by: CrazyMax --- .github/workflows/build.yml | 1 + hack/release | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 997b8513..56dcbb2f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -164,6 +164,7 @@ jobs: ./hack/release ${{ env.RELEASE_OUT }} env: PLATFORMS: ${{ env.PLATFORMS }},darwin/amd64,darwin/arm64,windows/amd64,windows/arm64 + CHECKSUMS: 1 CACHEDIR_FROM: /tmp/.buildx-cache/${{ env.CACHEKEY_BINARIES }} - name: Upload artifacts diff --git a/hack/release b/hack/release index c91fab71..2d96aad3 100755 --- a/hack/release +++ b/hack/release @@ -6,6 +6,7 @@ OUT=${1:-release-out} set -eu -o pipefail : ${PLATFORMS=linux/amd64} +: ${CHECKSUMS=} importCacheFlags="" if [[ -n "$cacheRefFrom" ]] && [[ "$cacheType" = "local" ]]; then @@ -25,4 +26,12 @@ buildxCmd build $importCacheFlags \ if [[ $PLATFORMS =~ "," ]]; then mv -f ./$OUT/**/* ./$OUT/ find ./$OUT -type d -empty -delete -fi \ No newline at end of file +fi + +if [ -n "$CHECKSUMS" ]; then + if ! type shasum > /dev/null 2>&1; then + echo >&2 "ERROR: shasum is required" + exit 1 + fi + find ./$OUT/ -type f \( -iname "buildx-*" ! -iname "*darwin*" \) -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# .*/# #' > ./$OUT/checksums.txt +fi