Skip to content

Commit

Permalink
Make release process more robust
Browse files Browse the repository at this point in the history
- Fixes tag retrieval
- Builds the right os and arch by default
  • Loading branch information
bcomnes committed Mar 23, 2019
1 parent 2ed704b commit a5679f7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ lint: ## Run golint to ensure the code follows Go styleguide.

publish: release upload ## Build and upload a release to GitHub releases.

release: build ## Build the linux binary and prepares the release as a tarball.
release: ## Build the linux binary and prepares the release as a tarball.
$(eval TAG := $(shell git describe --tags --abbrev=0 | cut -c 2-))
@GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/netlify/binrc/cmd.Version=`git rev-parse HEAD`"
@rm -rf releases/*
@mkdir -p releases/binrc_${TAG}_linux_amd64
@mv binrc releases/binrc_${TAG}_linux_amd64/binrc_${TAG}_linux_amd64
@cp LICENSE releases/binrc_${TAG}_linux_amd64/
@tar -C releases -czvf releases/binrc_${TAG}_Linux-64bit.tar.gz binrc_${TAG}_linux_amd64
@mkdir -p releases/binrc_$(TAG)_linux_amd64
@mv binrc releases/binrc_$(TAG)_linux_amd64/binrc_$(TAG)_linux_amd64
@cp LICENSE releases/binrc_$(TAG)_linux_amd64/
@tar -C releases -czvf releases/binrc_$(TAG)_Linux-64bit.tar.gz binrc_$(TAG)_linux_amd64

test: lint ## Run tests.
@go test -v ./...

upload: ## Upload release to GitHub releases.
@hub release create -a releases/binrc_${TAG}_Linux-64bit.tar.gz v${TAG}
$(eval TAG := $(shell git describe --tags --abbrev=0 | cut -c 2-))
@hub release create -a releases/binrc_$(TAG)_Linux-64bit.tar.gz v$(TAG)

0 comments on commit a5679f7

Please sign in to comment.