-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds infrastructure to release gowsdl binaries.
- Loading branch information
Showing
4 changed files
with
67 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
./gowsdl | ||
myservice | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
GHACCOUNT := hooklift | ||
NAME := gowsdl | ||
VERSION := v0.1.0 | ||
|
||
include common.mk | ||
|
||
deps: | ||
go get github.com/c4milo/github-release | ||
go get github.com/mitchellh/gox | ||
go get github.com/hooklift/assert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
PLATFORM := $(shell go env | grep GOHOSTOS | cut -d '"' -f 2) | ||
ARCH := $(shell go env | grep GOARCH | cut -d '"' -f 2) | ||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD) | ||
LDFLAGS := -ldflags "-X main.Version=$(VERSION) -X main.Name=$(NAME)" | ||
|
||
test: | ||
go test ./... | ||
|
||
build: | ||
go build -o build/$(NAME) $(LDFLAGS) cmd/$(NAME).go | ||
|
||
install: | ||
go install $(LDFLAGS) | ||
|
||
compile: | ||
@rm -rf build/ | ||
@gox $(LDFLAGS) \ | ||
-os="darwin" \ | ||
-os="linux" \ | ||
-os="solaris" \ | ||
-os="freebsd" \ | ||
-output "build/$(NAME)_$(VERSION)_{{.OS}}_{{.Arch}}/$(NAME)" \ | ||
./... | ||
|
||
dist: compile | ||
$(eval FILES := $(shell ls build)) | ||
@rm -rf dist && mkdir dist | ||
@for f in $(FILES); do \ | ||
(cd $(shell pwd)/build/$$f && tar -cvzf ../../dist/$$f.tar.gz *); \ | ||
(cd $(shell pwd)/dist && shasum -a 512 $$f.tar.gz > $$f.sha512); \ | ||
echo $$f; \ | ||
done | ||
|
||
release: dist | ||
@latest_tag=$$(git describe --tags `git rev-list --tags --max-count=1`); \ | ||
comparison="$$latest_tag..HEAD"; \ | ||
if [ -z "$$latest_tag" ]; then comparison=""; fi; \ | ||
changelog=$$(git log $$comparison --oneline --no-merges --reverse); \ | ||
github-release $(GHACCOUNT)/$(NAME) $(VERSION) $(BRANCH) "**Changelog**<br/>$$changelog" 'dist/*'; \ | ||
git pull | ||
|
||
.PHONY: test build install compile deps dist release |
ad21f3e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit broke go get install of binary, I fixed this in 13eb19f.
ad21f3e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome. Does this get triggered on travis build or manually done?
ad21f3e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually, you commit everything locally, update the version in the Makefile, and
make release
will create a new tag and update the artifacts to Github releases for you.