Skip to content

Commit

Permalink
Introducing sha256 release values (#31)
Browse files Browse the repository at this point in the history
* Updates Makefile and travis ci files to execute shasum and sha256sum to produce terrahelp.SHA256SUMS file against built binaries.
  • Loading branch information
trentrosenbaum authored Dec 9, 2019
1 parent 4f5508d commit 36242fb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ deploy:
file_glob: true
file:
- dist/$NAME-*
- dist/$NAME.SHA256SUMS
skip_cleanup: true
on:
repo: opencredo/$NAME
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## 0.7.4 (unreleased)
* [PR-31](https://github.com/opencredo/terrahelp/pull/31) Introduces sha256sum file covering each distribution binary (resolves [#28](https://github.com/opencredo/terrahelp/issues/28))

## 0.7.3
* [PR-30](https://github.com/opencredo/terrahelp/pull/30) Updates Travis CI file to replace missed TRAGET reference with NAME to allow release uploads (resolves [#29](https://github.com/opencredo/terrahelp/issues/29))
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ PLATFORMS ?= darwin linux
ARCH ?= amd64
OS = $(word 1, $@)

SHA256_CMD = sha256sum
ifeq ($(shell uname), Darwin)
SHA256_CMD = shasum -a 256
endif

.PHONY: ensure-version
ensure-version:
ifeq ($(SKIP_GO_REQ_VERSION_CHECK),1)
Expand Down Expand Up @@ -67,12 +72,15 @@ $(PLATFORMS): ensure-version check test
@ echo "==> Building $(OS) distribution"
@ mkdir -p $(BIN)/$(OS)/$(ARCH)
@ mkdir -p $(DIST)

CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build $(BUILDARGS) -o $(BIN)/$(OS)/$(ARCH)/$(NAME)
cp -f $(BIN)/$(OS)/$(ARCH)/$(NAME) $(DIST)/$(NAME)-$(OS)-$(ARCH)

@ $(SHA256_CMD) $(DIST)/$(NAME)-$(OS)-$(ARCH) | awk '{$$2=" $(NAME)-$(OS)-$(ARCH)"; print $$0}' >> $(DIST)/$(NAME).SHA256SUMS

.PHONY: dist
dist: $(PLATFORMS)
@ true
@ touch $(DIST)/$(NAME).SHA256SUMS

.PHONY: dependencies
dependencies:
Expand Down

0 comments on commit 36242fb

Please sign in to comment.