Skip to content

Commit

Permalink
Update makefile to simplify release
Browse files Browse the repository at this point in the history
  • Loading branch information
tzmfreedom committed May 2, 2017
1 parent 04fe85c commit aa153b6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
23 changes: 19 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
language: go

install:
- go get github.com/Masterminds/glide
- sudo add-apt-repository ppa:masterminds/glide -y
- sudo apt-get update -q
- sudo apt-get install glide -y
script:
- make deps
- make test
- make deps
- make test
before_deploy:
- make cross-build
- make dist
deploy:
provider: releases
api_key:
secure: lY7gQnJAI/CSRcoTS1SaYpjimLMTdSO3OCC2mTm7sckqrGpU7iefF7+1wkof8fGDxAGEP+r6QjvcRatF/ehsxSNR1FtfjiFGqchzQfYRiJapA4TEZPtdvbyC/xE1i7UWUQBGZsiD8KGN7Wr3ymcDf/MtI9c1F6g7rUTFrHfHL8WvQNf6cnSwrD3J009G4uroB63l0vVkF2havBjZUScN2rZXNrivWSlmFhijADo9bB6NIzet/5nOJHHHs1X/tqkunJ6qlfy67MET/cjfYfLI9s/jwVXZHkQYg3xKMKk0C30wOx+lU4GHuf31VpzZmO4Ro9oXxVJqOeHpI8sSZB5s8oYMklUhpAN7DOalI/7ffAOOR7L1maJ14YseIoRO6OpUs7+/PgrgRk8RFu5ar8B+ewUONQd63jqPp8mKudnap5z9+pMir81w630ScUcgUtfCyfoVcJOrCeRALWTJjnE9Hx2WZxkOsdhIWnV+tEQXoK2lRT9y5CUe53NxxL0XU7II9i83k8VG58+kXtHspd4tw96KhRJ/OKI4PisCCdXvuCMECtqdIORce0NK1gsXad46AYZT+tkcWQ/TCnvRrIvLnjNeO3cZzAi9RqztH2IKUDB3zzsBqBri3ZAxnY8CW8qz70wI5sFEHTOGSz6WHS6b252fPUQsba1+QyfNh9GNus8=
skip_cleanup: true
overwrite: true
file_glob: true
file: dist/*.{tar.gz}
on:
repo: tzmfreedom/spm
tags: true
19 changes: 9 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
NAME := spm
SRCS := $(shell find . -type d -name vendor -prune -o -type f -name "*.go" -print)
VERSION := 0.2.0
VERSION := 0.2.1
REVISION := $(shell git rev-parse --short HEAD)
LDFLAGS := -ldflags="-s -w -X \"main.Version=$(VERSION)\" -X \"main.Revision=$(REVISION)\""
DIST_DIRS := find * -type d -exec

.DEFAULT_GOAL := bin/$(NAME)

Expand All @@ -14,19 +15,12 @@ test: glide
install: build
@go install

.PHONY: uninstall
uninstall:

.PHONY: clean
clean:
@rm -rf bin/*
@rm -rf vendor/*
@rm -rf dist/*

.PHONY: dist-clean
dist-clean: clean
@rm -f $(NAME).tar.gz

.PHONY: build
build:
-@goimports -w $(SRCS)
Expand All @@ -40,7 +34,7 @@ cross-build: deps
@for os in darwin linux windows; do \
for arch in amd64 386; do \
GOOS=$$os GOARCH=$$arch CGO_ENABLED=0 go build -a -tags netgo \
-installsuffix netgo $(LDFLAGS) -o dist/$(NAME)-$$os-$$arch; \
-installsuffix netgo $(LDFLAGS) -o dist/$$os-$$arch/$(NAME); \
done; \
done

Expand All @@ -60,4 +54,9 @@ bin/$(NAME): $(SRCS)

.PHONY: dist
dist:
@tar czfh $(NAME).tar.gz $(shell git ls-files)
@cd dist && \
$(DIST_DIRS) cp ../LICENSE {} \; && \
$(DIST_DIRS) cp ../README.md {} \; && \
$(DIST_DIRS) cp ../completions/zsh/_$(NAME) {} \; && \
$(DIST_DIRS) tar zcf $(NAME)-$(VERSION)-{}.tar.gz {} \;

0 comments on commit aa153b6

Please sign in to comment.