Repository navigation
Expand file tree
/
Copy pathmakefile
More file actions
24 lines (23 loc) · 1.55 KB
/
Copy pathmakefile
File metadata and controls
24 lines (23 loc) · 1.55 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
# $(shell cat), not $(file < ...). The file function arrived in GNU Make 4.0,
# and macOS still ships 3.81 from 2006 -- which does not report an unknown
# function, it reads $(file < VERSION) as a reference to a variable named
# "file < VERSION", finds nothing, and expands to empty. The release then ran
# `git tag -s` with no tag name.
ver = $(shell cat VERSION)
# Usage: make release name="Proxmox default disk fix"
# Produces a release titled "v0.9.1 Proxmox default disk fix".
# The tag is made with -m so it never opens an editor. Without it, `git tag -s`
# asks for a message interactively and aborts with "no tag message?" and exit
# 128 when the buffer is left empty -- which reads like a signing failure and is
# not one. The tag message matches the release title.
# Tags origin/main, not the current branch: a squash merge leaves the branch
# commit off main, and v1.5.0 was cut from one. No `git pull` either -- it ran
# on the merged branch, whose upstream is gone once the PR deletes it.
release:
@[ -n "$(name)" ] || { echo 'name is required, e.g. make release name="Short description"'; exit 1; }
@[ -n "$(ver)" ] || { echo 'VERSION is empty -- refusing to tag. Check that VERSION exists and that make can read it.'; exit 1; }
@git rev-parse -q --verify "refs/tags/$(ver)" >/dev/null && { echo 'Tag $(ver) already exists. Bump VERSION, or delete the tag to recut.'; exit 1; } || true
git fetch origin main --tags
git tag $(ver) -s -m "$(ver) $(name)" origin/main
git push origin refs/tags/$(ver)
gh release create $(ver) --title "$(ver) $(name)" --generate-notes