-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile.release
91 lines (73 loc) · 2.79 KB
/
Makefile.release
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
# -*- mode: makefile-gmake; coding: utf-8 -*-
# :Project: pglast -- Release targets
# :Created: gio 03 ago 2017 14:53:18 CEST
# :Author: Lele Gaifax <lele@metapensiero.it>
# :License: GNU General Public License version 3 or later
# :Copyright: © 2017, 2018, 2019, 2020, 2021, 2022, 2023 Lele Gaifax
#
BUMPER := $(VENVDIR)/bin/bump_version
VERSION_TXT := version.txt
VERSION = $(shell cat $(VERSION_TXT))
MOD_INIT := pglast/__init__.py
DOCS_CONF := docs/conf.py
TWINE := $(VENVDIR)/bin/twine
help::
@printf "\nRelease management\n"
@printf "==================\n\n"
.PHONY: assert-clean-tree
assert-clean-tree:
@(test -z "$(shell git status -s --untracked=no)" || \
(echo "UNCOMMITTED STUFF" && false))
help::
@printf "release\n\tBump version number\n"
.PHONY: release
release: $(VENVDIR)/extension.timestamp enums keywords printers-doc assert-clean-tree
$(BUMPER) $(VERSION_TXT)
@echo ">>>"
@echo ">>> Do your duties (update CHANGES.rst for example), then"
@echo ">>> execute “make tag-release”."
@echo ">>>"
help::
@printf "dev-release\n\tBump the development version number\n"
.PHONY: dev-release
dev-release: $(VENVDIR)/extension.timestamp printers-doc assert-clean-tree
$(BUMPER) -s pep440 -f dev $(VERSION_TXT)
@echo ">>>"
@echo ">>> Do your duties (update CHANGES.rst for example), then"
@echo ">>> execute “make dev-tag-release”."
@echo ">>>"
help::
@printf "tag-release\n\tComplete the release tagging the working tree\n"
.PHONY: inject-version
inject-version:
sed -i "s/__version__ = '.*'/__version__ = 'v$(VERSION)'/" $(MOD_INIT)
sed -i "s/release = '.*'/release = 'v$(VERSION)'/" $(DOCS_CONF)
.PHONY: tag-release
tag-release: check-release-date check-long-description-markup inject-version
git commit -a -m "Release $(VERSION)"
git tag -a -m "Version $(VERSION)" v$(VERSION)
help::
@printf "dev-tag-release\n\tComplete the development release tagging the working tree\n"
.PHONY: dev-tag-release
dev-tag-release: check-release-date check-long-description-markup inject-version
git commit -a -m "Development release $(VERSION)"
git tag -a -m "Development version $(VERSION)" v$(VERSION)
.PHONY: check-long-description-markup
check-long-description-markup:
@$(PYTHON) setup.py --quiet sdist
@$(TWINE) check dist/pglast-$(VERSION).tar.gz
.PHONY: check-release-date
check-release-date:
@fgrep -q "$(VERSION) ($(shell date --iso-8601))" CHANGES.rst \
|| (echo "ERROR: release date of version $(VERSION) not set in CHANGES.rst"; exit 1)
help::
@printf "pypi-upload\n\tUpload the source distribution to PyPI\n"
.PHONY: pypi-upload
pypi-upload: assert-clean-tree
@$(PYTHON) setup.py sdist
$(TWINE) upload dist/pglast-$(VERSION).tar.gz
help::
@printf "publish\n\tUpload to PyPI, push changes and tags to the remote repo\n"
.PHONY: publish
publish: pypi-upload
git push --follow-tags