Skip to content

Commit c6e05d4

Browse files
committed
Add checksums
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
1 parent d01a335 commit c6e05d4

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,4 @@ jobs:
7979
files: |
8080
dist/**/*.tar.gz
8181
dist/**/*.zip
82+
dist/**/*.txt

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ linux_platforms := linux_amd64 linux_arm64
3434
non_windows_platforms := darwin_amd64 darwin_arm64 $(linux_platforms)
3535
windows_platforms := windows_amd64
3636

37-
archives := $(non_windows_platforms:%=dist/$(name)_$(VERSION)_%.tar.gz) $(windows_platforms:%=dist/$(name)_$(VERSION)_%.zip)
37+
archives := $(non_windows_platforms:%=dist/$(name)_$(VERSION)_%.tar.gz) $(windows_platforms:%=dist/$(name)_$(VERSION)_%.zip)
38+
checksums := dist/$(name)_$(VERSION)_checksums.txt
3839

3940
# Go tools directory holds the binaries of Go-based tools.
4041
go_tools_dir := $(CACHE_DIR)/tools/go
@@ -69,8 +70,14 @@ help: ## Describe how to use each target
6970
build: $(current_binary) ## Build the proxy binary
7071

7172
# This generates the assets that attach to a release.
72-
# TODO(dio): Generate checksums for the assets.
73-
dist: $(archives) ## Generate release assets
73+
dist: $(archives) $(checksums) ## Generate release assets
74+
75+
# Darwin doesn't have sha256sum. See https://github.com/actions/virtual-environments/issues/90
76+
sha256sum := $(if $(findstring darwin,$(goos)),shasum -a 256,sha256sum)
77+
$(checksums): $(archives)
78+
@printf "$(ansi_format_dark)" sha256sum "generating $@"
79+
@$(sha256sum) $^ > $@
80+
@printf "$(ansi_format_bright)" sha256sum "ok"
7481

7582
# By default, unless GOMAXPROCS is set via an environment variable or explicity in the code, the
7683
# tests are run with GOMAXPROCS=1. This is problematic if the a test requires more than one CPU, for

0 commit comments

Comments
 (0)