Skip to content

Commit ae17c60

Browse files
committed
add tag-release target
1 parent 75d9a5a commit ae17c60

File tree

2 files changed

+71
-4
lines changed

2 files changed

+71
-4
lines changed

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: helm-docs version-increment bump-major bump-minor bump-patch prepare-branch
1+
.PHONY: helm-docs version-increment bump-major bump-minor bump-patch prepare-branch tag-release
22

33
help: Makefile ## Prints this help message.
44
@grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -e 's/:.*##/#/' | column -c 2 -t -s#
@@ -9,15 +9,15 @@ helm-docs: ## Regenerates helm docs
99
version-increment:
1010
@if [ -z "$(CHART)" ]; then echo 'CHART=$$NAME must be specified'; exit 1; fi
1111

12-
@current_version="$$(yq -r '.version' "$(CHART)/Chart.yaml")"; \
12+
@current_version="$$(yq -r '.version' "$(CHART)/Chart.yaml")" && \
1313
export next_version="$$(yq -r '.version | capture("v?(?P<major>[0-9]+)\\.(?P<minor>[0-9]+)\\.(?P<patch>[0-9]+).*") \
1414
| ."$(NEXT)" |= (tonumber + 1 | tostring) \
1515
| .major |= ("$(MAJOR_VERSION)" | select(. != "") // .major) \
1616
| .minor |= ("$(MINOR_VERSION)" | select(. != "") // .minor) \
1717
| .patch |= ("$(PATCH_VERSION)" | select(. != "") // .patch) \
1818
| "v" + ([.major, .minor, .patch] | join(".")) \
19-
' "$(CHART)/Chart.yaml")"; \
20-
echo "Updating version: $$current_version -> $$next_version"; \
19+
' "$(CHART)/Chart.yaml")" && \
20+
echo "Updating version: $$current_version -> $$next_version" && \
2121
yq -i '.version = env(next_version)' "$(CHART)/Chart.yaml"
2222

2323
bump-major: NEXT=major
@@ -46,3 +46,11 @@ prepare-branch: ## Prepares CHART release branch. Use bump-* to bump the version
4646
fi; \
4747
echo ""; \
4848
echo "Branch prepared! Run: git push origin releases/$(CHART)/$$current_version"
49+
50+
tag-release: ## Creates a CHART tag.
51+
@if [ -z "$(CHART)" ]; then echo 'CHART=$$NAME must be specified'; exit 1; fi
52+
53+
@current_version="$$(yq -r '.version' "$(CHART)/Chart.yaml")"; \
54+
git tag -a -m "$$current_version" "$(CHART)/$$current_version" && \
55+
echo "Tag $(CHART)/$$current_version is ready to be pushed." && \
56+
echo "Use git push origin --tags $(CHART)/$$current_version"

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ This will create a new branch named `releases/CHART/VERSION`.
2424

2525
You may also combine both of these steps with `make CHART=CHART_NAME bump-patch prepare-branch`.
2626

27+
Once prepared push the branch.
28+
Once merged a new tag can be cut.
29+
First make sure you have the most recent changes:
30+
31+
```shell
32+
git checkout main
33+
git pull origin main
34+
git fetch origin
35+
```
36+
37+
Then tag the release with `make CHART=CHART_NAME tag-release`.
38+
Once tagged, push the new tag with `git push origin --tags $TAG`
39+
2740
Example output:
2841

2942
~~~shell
@@ -80,4 +93,50 @@ Changes to be committed:
8093
2 files changed, 3 insertions(+), 3 deletions(-)
8194
8295
Branch prepared! Run: git push origin releases/voyager/v0.2.3
96+
97+
$ git push origin releases/voyager/v0.2.3
98+
Enumerating objects: 9, done.
99+
Counting objects: 100% (9/9), done.
100+
Delta compression using up to 16 threads
101+
Compressing objects: 100% (5/5), done.
102+
Writing objects: 100% (5/5), 721 bytes | 721.00 KiB/s, done.
103+
Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
104+
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
105+
remote:
106+
remote: Create a pull request for 'releases/voyager/v0.2.3' on GitHub by visiting:
107+
remote: https://github.com/mikemrm/charts/pull/new/releases/voyager/v0.2.3
108+
remote:
109+
To github.com:mikemrm/charts.git
110+
* [new branch] releases/voyager/v0.2.3 -> releases/voyager/v0.2.3
111+
112+
$ git checkout main
113+
Switched to branch 'main'
114+
115+
$ git pull origin main
116+
remote: Enumerating objects: 1, done.
117+
remote: Counting objects: 100% (1/1), done.
118+
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
119+
Unpacking objects: 100% (1/1), 905 bytes | 905.00 KiB/s, done.
120+
From github.com:mikemrm/charts
121+
* branch main -> FETCH_HEAD
122+
1c87390..75d9a5a main -> origin/main
123+
Updating 1c87390..75d9a5a
124+
Fast-forward
125+
voyager/Chart.yaml | 2 +-
126+
voyager/README.md | 4 ++--
127+
2 files changed, 3 insertions(+), 3 deletions(-)
128+
129+
$ git fetch origin
130+
131+
$ make CHART=voyager tag-release
132+
Tag voyager/v0.1.3 is ready to be pushed.
133+
Use git push origin --tags voyager/v0.1.3
134+
135+
$ git push origin --tags voyager/v0.1.3
136+
Enumerating objects: 1, done.
137+
Counting objects: 100% (1/1), done.
138+
Writing objects: 100% (1/1), 161 bytes | 161.00 KiB/s, done.
139+
Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
140+
To github.com:mikemrm/charts.git
141+
* [new tag] voyager/v0.1.3 -> voyager/v0.1.3
83142
~~~

0 commit comments

Comments
 (0)