Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5da163

Browse files
committed
Have "make release" check other release preconditions
As documented in the release instructions in README.md.
1 parent ae9405a commit f5da163

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

Makefile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,29 @@ clean:
77
rm -rf build/ dist/ .eggs/ .tox/
88

99
release: clean
10-
# Check if latest tag is the current head we're releasing
11-
@config_opts="$$(printf ' -c versionsort.suffix=-%s' alpha beta pre rc RC)" && \
10+
# Check that VERSION and changes.rst exist and have no uncommitted changes
11+
test -f VERSION
12+
test -f doc/source/changes.rst
13+
git status -s VERSION doc/source/changes.rst
14+
@test -z "$$(git status -s VERSION doc/source/changes.rst)"
15+
16+
# Check that ALL changes are commited (can comment out if absolutely necessary)
17+
git status -s
18+
@test -z "$$(git status -s)"
19+
20+
# Check that latest tag matches version and is the current head we're releasing
21+
@version_file="$$(cat VERSION)" && \
22+
changes_file="$$(awk '/^[0-9]/ {print $$0; exit}' doc/source/changes.rst)" && \
23+
config_opts="$$(printf ' -c versionsort.suffix=-%s' alpha beta pre rc RC)" && \
1224
latest_tag=$$(git $$config_opts tag -l '[0-9]*' --sort=-v:refname | head -n1) && \
1325
head_sha=$$(git rev-parse HEAD) latest_tag_sha=$$(git rev-parse "$$latest_tag") && \
14-
printf '%-14s = %s\n' 'Latest tag' "$$latest_tag" \
26+
printf '%-14s = %s\n' 'VERSION file' "$$version_file" \
27+
'changes.rst' "$$changes_file" \
28+
'Latest tag' "$$latest_tag" \
1529
'HEAD SHA' "$$head_sha" \
1630
'Latest tag SHA' "$$latest_tag_sha" && \
31+
test "$$version_file" = "$$changes_file" && \
32+
test "$$latest_tag" = "$$version_file" && \
1733
test "$$head_sha" = "$$latest_tag_sha"
1834

1935
make force_release

0 commit comments

Comments
 (0)