Skip to content

Commit 055136b

Browse files
authored
Merge pull request #179 from threefoldtech/master-add-makefile
Adding makefile version-bump
2 parents f5cbdf6 + 883894b commit 055136b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.PHONY: version-bump
2+
3+
# usage: > type=patch make version-bump
4+
# usage: > type=minor make version-bump
5+
# usage: > type=major make version-bump
6+
version-bump:
7+
set -e; \
8+
if [ "$(type)" = "patch" ] || [ "$(type)" = "minor" ] || [ "$(type)" = "major" ]; then \
9+
default_branch=$$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'); \
10+
git checkout $$default_branch; \
11+
git pull origin $$default_branch; \
12+
new_version=$$(npx semver -i $(type) $$(jq -r .version package.json)); \
13+
branch_name="$$default_branch-bump-version-to-$$new_version"; \
14+
git checkout -b $$branch_name; \
15+
jq ".version = \"$$new_version\"" package.json > temp.json && mv temp.json package.json; \
16+
sed -i "s/^appVersion: .*/appVersion: '$$new_version'/" indexer/chart/Chart.yaml; \
17+
sed -i "s/^appVersion: .*/appVersion: '$$new_version'/" processor-chart/Chart.yaml; \
18+
git add processor-chart/Chart.yaml indexer/chart/Chart.yaml package.json ; \
19+
git commit -m "Bump version to $$new_version"; \
20+
else \
21+
echo "Invalid version type. Please use patch, minor, or major."; \
22+
fi

0 commit comments

Comments
 (0)