-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
102 lines (78 loc) · 3.56 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
92
93
94
95
96
97
98
99
100
101
102
include ./standard.mk
HOMEBREW_PACKAGES=bash coreutils editorconfig-checker findutils git git-cliff git-lfs go grep jq k1LoW/tap/tbls nodejs pre-commit [email protected] trivy trufflesecurity/trufflehog/trufflehog
#-------------------------------------------------------------------------------
# Environment
.PHONY: install-hooks
## install-hooks: [tools] Install/upgrade the Git hooks used for ensuring consistency.
install-hooks:
@ $(HEADER) "=====> Installing Git hooks..."
cp -vf .githooks/commit-msg.sh .git/hooks/commit-msg
chmod +x .git/hooks/*
pre-commit install
@ $(BORDER) "Learn more about 'pre-commit' at:" " https://pre-commit.com" " " "Learn more about 'gommit' at:" " https://github.com/antham/gommit"
# goplicate-start:linting
#-------------------------------------------------------------------------------
# Linting
.PHONY: pre-commit
## pre-commit: [lint]* Runs `pre-commit` against all files.
pre-commit:
@ $(HEADER) "=====> Running pre-commit..."
pre-commit run --all-files
# goplicate-end:linting
# goplicate-start:git
#-------------------------------------------------------------------------------
# Git Tasks
.PHONY: changelog
## changelog: [release]* Generates the CHANGELOG for the release.
changelog:
@ $(HEADER) "=====> Updating the CHANGELOG..."
git cliff -o CHANGELOG.md
.PHONY: tag
## tag: [release]* Signs and tags the release.
tag:
@ $(HEADER) "=====> Signing and tagging the release..."
@ if [ $$(git status -s -uall | wc -l) != 1 ]; then $(ERROR) "Git workspace must be clean."; exit 1; fi;
@ $(WHITE) "This release will be tagged as: $(NEXT_VERSION)"
@ echo "---------------------------------------------------------------------"
@ read -p "Press any key to continue, or press Control+C to cancel. " x;
@ echo " "
@ chag update $(NEXT_VERSION)
@ echo " "
@ $(HEADER) "These are the contents of the CHANGELOG for this release. Are these correct?"
@ $(WHITE) "---------------------------------------------------------------------"
@ chag contents
@ $(WHITE) "---------------------------------------------------------------------"
@ echo "Are these release notes correct? If not, cancel and update CHANGELOG.md."
@ read -p "Press any key to continue, or press Control+C to cancel. " x;
@ echo " "
git add .
git commit -a -m "relprep: Preparing the $(NEXT_VERSION) release." --no-verify
chag tag --sign
# goplicate-end:git
#-------------------------------------------------------------------------------
# Specific to this project.
.PHONY: clean
## clean: [clean]* Run standard cleanup tasks.
clean: clean-ds
.PHONY: lint
## lint: [lint]* Run linting tasks.
lint: pre-commit
.PHONY: test
## test: [test]* Runs ALL tests.
test:
#-------------------------------------------------------------------------------
# Installation
.PHONY: install-tools-go
## install-tools-go: [tools]* Install/upgrade the required Go packages.
install-tools-go:
@ $(HEADER) "=====> Installing Go packages..."
$(GO) install github.com/antham/gommit@latest
$(GO) install github.com/google/yamlfmt/cmd/yamlfmt@latest
$(GO) install github.com/pelletier/go-toml/v2/cmd/tomljson@latest
.PHONY: install-tools-mac
## install-tools-mac: [tools]* Install/upgrade the required tools for macOS, including Go packages.
install-tools-mac: install-tools-go
@ $(HEADER) "=====> Installing required packages for macOS (Homebrew)..."
brew update && brew install $(HOMEBREW_PACKAGES) && brew upgrade $(HOMEBREW_PACKAGES)
curl -sSLf https://raw.githubusercontent.com/mtdowling/chag/master/install.sh | sudo bash
@ $(BORDER) "To update to the latest versions, run:" " brew update && brew upgrade"