-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
83 lines (67 loc) · 2.21 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
SWAGGER_VERSION := $(shell swagger version 2>/dev/null)
all: generate
.PHONY: build
build:
go build -v ./...
.PHONY: test
test:
go test -v ./...
.PHONY: lint
lint:
golangci-lint run --out-format=github-actions ./...
# Note: if you have multiple versions of swagger installed locally, point to the one located in your go path,
# e.g. /Users/<username>/go/bin/swagger
.PHONY: generate
generate: you-need-to-install-go-swagger-check-readme clean
mkdir -p pkg/api
swagger generate client -f api/public_api.swagger.json -t pkg/api -A TurnkeyAPI -T templates --allow-template-override
go mod tidy
.PHONY: clean
clean:
rm -rf pkg/api
.PHONY: changelog
changelog:
@if [ -f "CHANGELOG.md" ]; then \
mv CHANGELOG.md CHANGELOG.md.backup; \
fi
@git-chglog -o CHANGELOG.md
@echo "Generated CHANGELOG.md"
@echo "Review the changes and commit if satisfied:"
@echo " git add CHANGELOG.md"
@echo " git commit -m 'docs: update changelog'"
.PHONY: changelog-next
changelog-next:
@if [ "$(v)" = "" ]; then \
echo "Error: version number required. Use: make changelog-next v=1.0.0"; \
exit 1; \
fi
@echo "Previewing changes for v$(v)..."
@git-chglog --next-tag v$(v)
.PHONY: prepare-release
prepare-release:
@if [ "$(v)" = "" ]; then \
echo "Error: version number required. Use: make prepare-release v=1.0.0"; \
exit 1; \
fi
@echo "Generating changelog for v$(v)..."
@git-chglog --next-tag v$(v) -o CHANGELOG.md
@echo "Generated CHANGELOG.md"
@echo "Review the changes and commit if satisfied:"
@echo " git add CHANGELOG.md"
@echo " git commit -m 'add changelog for v$(v)'"
.PHONY: publish-release
publish-release:
@if [ "$(v)" = "" ]; then \
echo "Error: version number required. Use: make publish-release v=1.0.0"; \
exit 1; \
fi
@echo "\nCreating and signing tag v$(v)..."
git config tag.forceSignAnnotated true
git tag -a v$(v) -m "Release v$(v)" -s
@echo "\nPushing changes..."
git push origin main
git push origin v$(v)
@echo "\nTriggering pkg.go.dev update..."
@curl -s "https://sum.golang.org/lookup/github.com/tkhq/go-sdk@v$(v)" || true
@echo "\nRelease v$(v) complete. The package will be available on pkg.go.dev shortly."
you-need-to-install-go-swagger-check-readme: ; @which swagger > /dev/null