1# TODO:
2# - Update binary assets from bat
3# - Update README prior to release
4# - Update help text in README, with BAT_THEME unset
5
6release: \
7	clean \
8	check-environment \
9	bump-version \
10	create-github-release \
11	bump-version-in-documentation-links \
12	bump-private-homebrew-formula
13
14
15clean:
16	rm -fr .make-sentinels
17
18
19check-environment:
20	[ -n  "$$DELTA_OLD_VERSION" ]
21	[ -n  "$$DELTA_NEW_VERSION" ]
22	mkdir -p .make-sentinels
23	@echo "Release: $$DELTA_OLD_VERSION => $$DELTA_NEW_VERSION"
24
25
26BUMP_VERSION_SENTINEL=.make-sentinels/bump-version
27bump-version: $(BUMP_VERSION_SENTINEL)
28$(BUMP_VERSION_SENTINEL):
29	@echo Bumping version in Cargo.toml
30	sed -i -E "s,^version = \"$$DELTA_OLD_VERSION\",version = \"$$DELTA_NEW_VERSION\",g" Cargo.toml
31	make build
32	make test
33	git add Cargo.toml Cargo.lock
34	git commit -m "Bump version" || true
35	touch $(BUMP_VERSION_SENTINEL)
36
37
38CREATE_GITHUB_RELEASE_SENTINEL=.make-sentinels/create-github-release
39create-github-release: $(CREATE_GITHUB_RELEASE_SENTINEL) check-environment
40$(CREATE_GITHUB_RELEASE_SENTINEL):
41	which gren > /dev/null
42	@echo \# Creating release tag
43	git tag "$$DELTA_NEW_VERSION"
44	git push
45	git push --tags
46	@echo \# Draft and edit release notes in Github
47	gren release -d -t "$$DELTA_NEW_VERSION".."$$DELTA_OLD_VERSION"
48	@echo \# Wait for assets to appear at https://github.com/dandavison/delta/releases
49	touch $(CREATE_GITHUB_RELEASE_SENTINEL)
50
51
52BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL=.make-sentinels/bump-version-in-documentation-links
53bump-version-in-documentation-links: $(BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL)
54$(BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL):
55	sed -i -E "s,$$DELTA_OLD_VERSION,$$DELTA_NEW_VERSION,g" README.md
56	git add README.md
57	git commit -m "Bump version in links to executables"
58	touch $(BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL)
59
60
61BUMP_PRIVATE_HOMEBREW_FORMULA_SENTINEL=.make-sentinels/bump-private-homebrew-formula
62bump-private-homebrew-formula: $(BUMP_PRIVATE_HOMEBREW_FORMULA_SENTINEL)
63$(BUMP_PRIVATE_HOMEBREW_FORMULA_SENTINEL):
64	sed -i -E "s,$$DELTA_OLD_VERSION,$$DELTA_NEW_VERSION,g" HomeBrewFormula/git-delta.rb
65	make hash
66	@echo \# modify hashes in HomeBrewFormula/git-delta.rb
67	git add HomeBrewFormula/git-delta.rb
68	git commit -m "Bump version in private Homebrew formula"
69	touch $(BUMP_PRIVATE_HOMEBREW_FORMULA_SENTINEL)
70
71
72.PHONY: \
73	clean \
74	release	\
75	check_environment \
76	bump-version \
77	create-github-release \
78	bump-version-in-documentation-links \
79	bump-private-homebrew-formula
80