-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmakefile
77 lines (63 loc) · 2.85 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
COMMIT ?= HEAD
PACKAGE ?= github.com/james-lawrence/bw/cmd
VERSION = $(shell git describe --always --tags --long $(COMMIT))
RELEASE ?= 0.1.$(shell git show -s --format=%ct-%h $(COMMIT))
BW_VERSION ?= 0.1.$(shell git show -s --format=%ct $(COMMIT))
LDFLAGS ?= ""
release-dev-setup:
podman build --arch=amd64 -t debian-build -f .dist/deb/Dockerfile .
generate:
go generate ./...
install:
go install -ldflags=$(LDFLAGS) $(PACKAGE)/...
build: generate install
install-debug:
go install -tags="debug.enabled" -ldflags=$(LDFLAGS) $(PACKAGE)/...
test:
ginkgo -r -p -keepGoing .
release-push: release
git tag --force $(RELEASE)
# dput -f -c .dist/deb/dput.config bw .dist/build/bearded-wookie_$(BW_VERSION)_source.changes
# hub release create -a .dist/build/bearded-wookie-linux-amd64-$(RELEASE).tar.gz $(RELEASE) -m "linux-amd64-$(RELEASE)"
echo "released version: $(RELEASE) completed successfully"
release-check:
ifeq ($(origin ALLOW_DIRTY), undefined)
git diff --exit-code --quiet || { echo repository has uncommitted files. set ALLOW_DIRTY to ignore this check; exit 1; }
endif
release: release-check
rm -rf .dist/build && mkdir -p .dist/build
mkdir -p .dist/cache
git log $(shell git describe --tags --abbrev=0)..HEAD > .dist/RELEASE-NOTES.md
# build amd64 tar bundle
rsync --exclude '.gitignore' --recursive $(CURDIR)/.dist/linux/ $(CURDIR)/.dist/build/bearded-wookie-linux-amd64-$(RELEASE)/
GOBIN=$(CURDIR)/.dist/build/bearded-wookie-linux-amd64-$(RELEASE)/usr/local/bin GOARCH=amd64 GOOS=linux go install -ldflags=$(LDFLAGS) $(PACKAGE)/bw
tar -C .dist --xform 's:^\./::' -czf .dist/build/bearded-wookie-linux-amd64-$(RELEASE).tar.gz \
RELEASE-NOTES.md \
-C build/bearded-wookie-linux-amd64-$(RELEASE) .
# tar -f .dist/build/bearded-wookie-linux-amd64-$(RELEASE).tar.gz --delete '.test'
# git archive --format=tar -o $(CURDIR)/.dist/build/bearded-wookie-source-$(RELEASE).tar HEAD
rm -rf $(CURDIR)/.dist/build/bearded-wookie-source-$(RELEASE)
# git bundle create $(CURDIR)/.dist/build/git.bundle HEAD
# git clone $(CURDIR)/.dist/build/git.bundle
git clone --depth 1 file://$(CURDIR) $(CURDIR)/.dist/build/bearded-wookie-source-$(RELEASE)
tar -C .dist --xform 's:^\./::' \
--exclude=".test" \
--exclude=".examples" \
-czf .dist/build/bearded-wookie-source-$(RELEASE).tar.gz \
RELEASE-NOTES.md \
-C build/bearded-wookie-source-$(RELEASE) .
# --user $(shell id -u):$(shell id -g) \
podman run \
-e BUILD_VERSION=$(RELEASE) \
-e BW_VERSION=$(BW_VERSION) \
-e BW_LDFLAGS=$(LDFLAGS) \
-e CACHE_DIR="/opt/bw/.dist/cache" \
-e HOME="/opt/bw/.dist/cache" \
-e DEBEMAIL="$(shell git config user.email)" \
-e DEBFULLNAME="$(shell git config user.name)" \
-v $(CURDIR):/opt/bw \
-v $(HOME)/.gnupg:/opt/bw/.dist/cache/.gnupg \
-it debian-build:latest
git add .dist/RELEASE-NOTES.md && git commit -m "release $(RELEASE)";
release-clean:
rm -rf .dist/build