summaryrefslogtreecommitdiffstats
path: root/packaging/release/Makefile
blob: d1ff8f8851b452f2afa3325984a9337c78a7c737 (plain)
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
version ?= $(shell python versionhelper/version_helper.py --raw)

.PHONY: all
all:
	@echo "USAGE:"
	@echo
	@echo "make release version={version} # current version is '${version}'"
	@echo "make publish"
	@echo
	@echo "NOTE: Make sure to source hacking/env-setup before running these targets."

.PHONY: release
release: version summary changelog commit-release
	git show -p
	git status
	@echo
	@echo 'Run `git push` if you are satisfied with the changes.'

.PHONY: version
version:
	sed -i.bak "s/^__version__ = .*$$/__version__ = '${version}'/" ../../lib/ansible/release.py
	rm ../../lib/ansible/release.py.bak

.PHONY: summary
summary:
	@printf '%s\n%s\n%s\n' \
	'release_summary: |' \
	'   | Release Date: $(shell date '+%Y-%m-%d')' \
	'   | `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__' > \
	../../changelogs/fragments/v${version}_summary.yaml

.PHONY: changelog
changelog:
	antsibull-changelog release -vv --use-ansible-doc && antsibull-changelog generate -vv --use-ansible-doc
	ansible-test sanity changelogs/

.PHONY: commit-release
commit-release:
	git add ../../changelogs/ ../../lib/ansible/release.py
	git commit -m "New release v${version}"

.PHONY: publish
publish: tag postversion commit-postversion
	git show -p
	git status
	@echo
	@echo 'Run `git push --follow-tags` if you are satisfied with the changes.'

.PHONY: tag
tag:
	git tag -a v${version} -m "New release v${version}"

.PHONY: postversion
postversion:
	sed -i.bak "s/^__version__ = .*$$/__version__ = '${version}.post0'/" ../../lib/ansible/release.py
	rm ../../lib/ansible/release.py.bak

.PHONY: commit-postversion
commit-postversion:
	git add ../../lib/ansible/release.py
	git commit -m "Update Ansible release version to v${version}."