From aa153b673a41f8098ad8acc92e38e49fb06ae3c5 Mon Sep 17 00:00:00 2001 From: tzmfreedom Date: Tue, 2 May 2017 22:35:01 +0900 Subject: [PATCH] Update makefile to simplify release --- .travis.yml | 23 +++++++++++++++++++---- Makefile | 19 +++++++++---------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3be78a1..9a35175 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Makefile b/Makefile index 9b54dd7..422e068 100644 --- a/Makefile +++ b/Makefile @@ -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) @@ -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) @@ -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 @@ -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 {} \; +