-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (35 loc) · 1.23 KB
/
Makefile
File metadata and controls
61 lines (35 loc) · 1.23 KB
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
# VER := $(shell git describe --abbrev=0 --tags)
# lets just skip building a proper dependency tree
# thus, always build
# tag examples
# git tag -a v1.4 -m "my version 1.4"
all:
release: dockerbuild binbuild
# implies push
dockerbuild:
test "$$(git describe --tags)" = "$(VER)"
# if no tag specified, it defaults to latest:, SO DONT ADD :$(VER)
docker build -t deadsfu --build-arg VERSION=$(VER) .
docker image tag deadsfu x186k/deadsfu:latest
docker image tag deadsfu x186k/deadsfu:$(VER)
docker image push --all-tags x186k/deadsfu
PLATFORMS := linux/amd64 windows/amd64 darwin/amd64 darwin/arm64 linux/arm64
temp = $(subst /, ,$@)
os = $(word 1, $(temp))
arch = $(word 2, $(temp))
ext = $(if $(findstring windows,$(os)),.exe)
binname = deadsfu$(ext)
bintarname = dist/deadsfu-$(os)-$(arch).tar.gz
goflags = -ldflags "-X main.Version=$(VER)"
binbuild: cleardist $(PLATFORMS)
test "$$(git describe --tags)" = "$(VER)"
gh release upload $(VER) --clobber ./dist/*
cleardist:
rm -rf dist
mkdir dist
$(PLATFORMS):
GOOS=$(os) GOARCH=$(arch) go build -o $(binname) $(goflags) .
tar -czf $(bintarname) $(binname)
rm $(binname)
openssl md5 -r $(bintarname) | sed 's/ .*//g' >$(bintarname).md5
.PHONY: release $(PLATFORMS)