-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
34 lines (27 loc) · 1.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
GOPATH ?= $(shell go env GOPATH)
GORELEASER ?= $(GOPATH)/bin/goreleaser
VERSION := v$(shell cat VERSION)
.PHONY: test build build-snapshot sync-tag release
all: test build build-snapshot sync-tag release
test:
@echo '>> unit test'
@go test ./...
build:
@echo '>> build'
go build -ldflags='-X github.com/kobtea/go-todoist/cmd/todoist/cmd.Version=$(shell cat VERSION)' \
-o dist/todoist \
./cmd/todoist
build-snapshot: $(GORELEASER)
@echo '>> cross-build for testing'
$(GORELEASER) release --snapshot --rm-dist --debug
sync-tag:
@git config user.name || git config --local user.name "circleci-job"
@git config user.email || git config --local user.email "kobtea9696@gmail.com"
@git rev-parse $(VERSION) > /dev/null 2>&1 || \
(git tag -a $(VERSION) -m "release $(VERSION)" && git push origin $(VERSION))
release: $(GORELEASER)
@echo '>> release'
$(GORELEASER) release --rm-dist --debug
$(GORELEASER):
@wget -O - "https://github.com/goreleaser/goreleaser/releases/download/v0.95.0/goreleaser_$(shell uname -o | cut -d'/' -f2)_$(shell uname -m).tar.gz" | tar xvzf - -C /tmp
@mv /tmp/goreleaser $(GOPATH)/bin