summaryrefslogtreecommitdiffstats
path: root/etc/release.Makefile
blob: c75bfd5b8caabfdac1a327ab6d164c33002688e5 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# TODO:
# - Update binary assets from bat
# - Update README prior to release
# - Update help text in README, with BAT_THEME unset

release: \
	clean \
	check-environment \
	bump-version \
	create-github-release \
	bump-version-in-documentation-links \
	bump-private-homebrew-formula


clean:
	rm -fr .make-sentinels


check-environment:
	[ -n  "$$DELTA_OLD_VERSION" ]
	[ -n  "$$DELTA_NEW_VERSION" ]
	mkdir -p .make-sentinels
	@echo "Release: $$DELTA_OLD_VERSION => $$DELTA_NEW_VERSION"


BUMP_VERSION_SENTINEL=.make-sentinels/bump-version
bump-version: $(BUMP_VERSION_SENTINEL)
$(BUMP_VERSION_SENTINEL):
	@echo Bumping version in Cargo.toml
	sed -i -E "s,^version = \"$$DELTA_OLD_VERSION\",version = \"$$DELTA_NEW_VERSION\",g" Cargo.toml
	make build
	make test
	git add Cargo.toml Cargo.lock
	git commit -m "Bump version" || true
	touch $(BUMP_VERSION_SENTINEL)


CREATE_GITHUB_RELEASE_SENTINEL=.make-sentinels/create-github-release
create-github-release: $(CREATE_GITHUB_RELEASE_SENTINEL) check-environment
$(CREATE_GITHUB_RELEASE_SENTINEL):
	which gren > /dev/null
	@echo \# Creating release tag
	git tag "$$DELTA_NEW_VERSION"
	git push
	git push --tags
	@echo \# Draft and edit release notes in Github
	gren release "$$DELTA_NEW_VERSION"
	@echo \# Wait for assets to appear at https://github.com/dandavison/delta/releases
	touch $(CREATE_GITHUB_RELEASE_SENTINEL)


BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL=.make-sentinels/bump-version-in-documentation-links
bump-version-in-documentation-links: $(BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL)
$(BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL):
	sed -i -E "s,$$DELTA_OLD_VERSION,$$DELTA_NEW_VERSION,g" README.md
	git add README.md
	git commit -m "Bump version in links to executables"
	touch $(BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL)


BUMP_PRIVATE_HOMEBREW_FORMULA_SENTINEL=.make-sentinels/bump-private-homebrew-formula
bump-private-homebrew-formula: $(BUMP_PRIVATE_HOMEBREW_FORMULA_SENTINEL)
$(BUMP_PRIVATE_HOMEBREW_FORMULA_SENTINEL):
	sed -i -E "s,$$DELTA_OLD_VERSION,$$DELTA_NEW_VERSION,g" HomeBrewFormula/git-delta.rb
	make hash
	@echo \# modify hashes in HomeBrewFormula/git-delta.rb
	git add HomeBrewFormula/git-delta.rb
	git commit -m "Bump version in private Homebrew formula"
	touch $(BUMP_PRIVATE_HOMEBREW_FORMULA_SENTINEL)


.PHONY: \
	clean \
	release	\
	check_environment \
	bump-version \
	create-github-release \
	bump-version-in-documentation-links \
	bump-private-homebrew-formula