forked from callowaylc/mq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (65 loc) · 1.46 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!make
OS ?= darwin
ARCH ?= amd64
PREFIX ?= ./build
VERSION := 1.11
TAG = $(shell date -u +'%Y.%m.%d-%H')
ORG = callowaylc
REPO = mq
ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
-include .env
export
.PHONY: make install release test clean
make:
mkdir -p ./build
#rm -rf ./build/*
- test "$(OS)" = "linux" && docker run \
--rm \
-e GOOS=$(OS) \
-e GOARCH=$(ARCH) \
-v `pwd`:/opt/bin \
-v `pwd`/build/cache:/go/pkg \
-w /opt/bin golang:$(VERSION) \
go build -v -o ./release/mq-$(OS)-$(ARCH) ./cmd/mq.go
- test "$(OS)" = "darwin" && \
vgo build -v -o ./release/mq-$(OS)-$(ARCH) ./cmd/mq.go
install:
mv ./build/logger-$(OS)-$(ARCH) $(PREFIX)/logger
release:
# NOTE: Add latest along with calendar version
# NOTE: Remove other releases from the same day
mkdir -p ./release
rm -rf ./release/*
OS=darwin make & \
OS=linux make & \
wait
git tag $(TAG) -f
git push origin $(TAG) -f
- github-release delete \
--user $(ORG) \
--repo $(REPO) \
--tag $(TAG)
github-release release --draft \
--user $(ORG) \
--repo $(REPO) \
--tag $(TAG) \
--name $(TAG)
ls ./release/* | xargs -n1 basename | xargs -n1 -I{} github-release upload \
--replace \
--user $(ORG) \
--repo $(REPO) \
--tag $(TAG) \
--name {} \
--file ./release/{}
publish:
github-release edit \
--user $(ORG) \
--repo $(REPO) \
--tag $(TAG) \
--name $(TAG)
test:
vgo build -v -o ./build/mq ./cmd/mq.go
clean:
rm -rf ./build
%:
@: