-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (26 loc) · 734 Bytes
/
Copy pathMakefile
File metadata and controls
32 lines (26 loc) · 734 Bytes
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
GOARCH=amd64
PLATFORMS=darwin linux windows
PKGS=$(shell go list ./...)
BIN_DIR=$(GOPATH)/bin
BINARY=gh-stars
DOCKER_IMAGE_PREFIX=augustohp
VERSION=$(shell grep "const Version" gh-stars.go | sed 's/[^0-9\.]//g')
build:
go build -o $(BIN_DIR)/$(BINARY) .
chmod +x $(BIN_DIR)/$(BINARY)
clean:
rm -rf dist
.PHONY: docker
docker:
docker build -t $(BINARY) .
.PHONY: docker-push
docker-push: docker
docker tag $(BINARY) $(DOCKER_IMAGE_PREFIX)/$(BINARY):$(VERSION)
docker push $(DOCKER_IMAGE_PREFIX)/$(BINARY)
os=$(word 1,$@)
.PHONY: ($PLATFORMS)
$(PLATFORMS):
@mkdir -p dist > /dev/null
GOOS=$(os) GOARCH=amd64 go build -o dist/$(BINARY)-$(VERSION)-$(os)-amd64
.PHONY: release
release: clean windows linux darwin docker-push