-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
64 lines (46 loc) · 1.28 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
54
55
56
57
58
59
60
61
62
63
64
.DEFAULT_GOAL := build
.PHONY: clean build fmt test
TAG ?= "v0.0.1"
BUILD_FLAGS ?=
BINARY ?= aws-sso
VERSION ?= $(shell git describe --tags --always --dirty)
LDFLAGS ?= -w -s
CLOUD_IMAGE ?= grepplabs/aws-sso:$(TAG)
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
default: build
check:
go vet ./...
golint $$(go list ./...) 2>&1
gosec ./... 2>&1
test:
GO111MODULE=on go test -mod=vendor -v ./...
build:
CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -o $(BINARY) $(BUILD_FLAGS) -ldflags "$(LDFLAGS)" .
fmt:
go fmt ./...
clean:
@rm -rf $(BINARY)
@rm -rf $(BINARY)*
.PHONY: deps
deps:
GO111MODULE=on go get ./...
.PHONY: vendor
vendor:
GO111MODULE=on go mod vendor
.PHONY: tidy
tidy:
GO111MODULE=on go mod tidy
.PHONY: tag
tag:
git tag $(TAG)
.PHONY: release-setup
release-setup:
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
.PHONY: release-skip-publish
release-skip-publish: release-setup
$(ROOT_DIR)/bin/goreleaser release --rm-dist --skip-publish --snapshot
.PHONY: release.publish
release-publish: release-setup
@[ "${GITHUB_TOKEN}" ] && echo "releasing $(TAG)" || ( echo "GITHUB_TOKEN is not set"; exit 1 )
git push origin $(TAG)
$(ROOT_DIR)/bin/goreleaser release --rm-dist