-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
91 lines (79 loc) · 2.12 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
83
84
85
86
87
88
89
90
91
PACKAGE_NAME := spotifox
GOLANG_CROSS_VERSION ?= v1.21.0
INJECT_PACKAGE ?= github.com/go-musicfox/spotify/pkg/constants
LDFLAGS := -s -w
LASTFM_KEY ?=
LASTFM_SECRET ?=
SPOTIFY_CLIENT_ID ?=
REGISTRY ?=
GORELEASER_IMAGE ?= alanalbert/goreleaser-musicfox:$(GOLANG_CROSS_VERSION)
SYSROOT_DIR ?= sysroots
SYSROOT_ARCHIVE ?= sysroots.tar.bz2
ifneq ($(REGISTRY),)
GORELEASER_IMAGE := $(REGISTRY)/go-musicfox/goreleaser-musicfox:$(GOLANG_CROSS_VERSION)
endif
.PHONY: build
build:
./hack/build.sh build
.PHONY: install
install:
./hack/build.sh install
.PHONY: scoop-config-gen
scoop-config-gen:
./hack/scoop_gen.sh
.PHONY: lint
lint:
golangci-lint run -v
.PHONY: lint-fix
lint-fix:
golangci-lint run --fix -v
.PHONY: sysroot-pack
sysroot-pack:
@tar cf - $(SYSROOT_DIR) -P | pv -s $[$(du -sk $(SYSROOT_DIR) | awk '{print $1}') * 1024] | pbzip2 > $(SYSROOT_ARCHIVE)
.PHONY: sysroot-unpack
sysroot-unpack:
@pv $(SYSROOT_ARCHIVE) | pbzip2 -cd | tar -xf -
.PHONY: release-dry-run
release-dry-run:
@docker run \
--rm \
--privileged \
-e CGO_ENABLED=1 \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v `pwd`/sysroot:/sysroot \
-w /go/src/$(PACKAGE_NAME) \
$(GORELEASER_IMAGE) \
--clean --skip-validate --skip-publish
.PHONY: release
release:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
--privileged \
-e CGO_ENABLED=1 \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v `pwd`/sysroot:/sysroot \
-w /go/src/$(PACKAGE_NAME) \
$(GORELEASER_IMAGE) \
release --clean
.PHONY: release-debug-shell
release-debug-shell:
docker run \
-it \
--rm \
--privileged \
--env-file .release-env \
-e CGO_ENABLED=1 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v `pwd`/sysroot:/sysroot \
-w /go/src/$(PACKAGE_NAME) \
--entrypoint="/bin/bash" \
$(GORELEASER_IMAGE)