This repository has been archived by the owner on Mar 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
53 lines (38 loc) · 1.57 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
.PHONY: tools check clean test build package package-snapshot docs docker-image
TAG_NAME := $(shell git tag -l --contains HEAD)
SHA := $(shell git rev-parse HEAD)
VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))
DATE := $(shell date +'%Y-%m-%d %H:%M:%S')
export GO111MODULE=on
export SHA
export VERSION
export DATE
default: tools check test build
tools: $(shell go env GOPATH)/bin/golangci-lint $(shell go env GOPATH)/bin/goreleaser $(shell go env GOPATH)/bin/seihon
$(shell go env GOPATH)/bin/golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.23.6
golangci-lint --version
$(shell go env GOPATH)/bin/goreleaser:
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | bash -s -- -b $(shell go env GOPATH)/bin
goreleaser --version
$(shell go env GOPATH)/bin/seihon:
curl -sfL https://raw.githubusercontent.com/ldez/seihon/master/godownloader.sh | bash -s -- -b $(shell go env GOPATH)/bin
seihon --version
test:
go test -v -cover ./...
clean:
rm -rf dist/
build: clean
@echo Version: $(VERSION)
go build -v -ldflags '-X "main.Version=${VERSION}" -X "main.ShortCommit=${SHA}" -X "main.Date=${DATE}"' .
check:
golangci-lint run
publish-images:
echo "$(DOCKERHUB_PASSWORD)" | docker login -u "$(DOCKERHUB_USERNAME)" --password-stdin
seihon publish -v "$(VERSION)" -v "latest" --image-name="containous/acme-fixer" --dry-run=false
release: tools
goreleaser release
release-snapshot: tools
goreleaser release --rm-dist --snapshot --skip-publish
doc:
go run . doc