File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ S3_BASE = s3://$(WRITE_BUCKET)/$(PROJECT)
1212REPORT ?= ./build/reports/tests/test/index.html
1313
1414.PHONY : all assemble clean test test-all check rebuild install package release verify fast \
15- coverage verifyCoverage \
15+ coverage verifyCoverage bump \
1616 check-env pkg-test dyn-test s3-overlay s3-test s3-in s3-out \
1717 pkg-fail path-input deps refresh
1818
@@ -58,6 +58,13 @@ check-env:
5858rebuild :
5959 ./gradlew clean build --refresh-dependencies
6060
61+ # make bump -> patch bump (default)
62+ # make bump LEVEL=minor -> minor bump
63+ # make bump LEVEL=major -> major bump
64+ LEVEL ?= patch
65+ bump :
66+ ./wf/bump-version.sh $(LEVEL )
67+
6168test-all : clean test
6269
6370install : assemble
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ LEVEL=" ${1:- patch} "
5+ case " $LEVEL " in
6+ patch|minor|major) ;;
7+ * ) echo " Usage: $0 [patch|minor|major]" >&2 ; exit 1 ;;
8+ esac
9+
10+ ROOT=" $( cd " $( dirname " $0 " ) /.." && pwd) "
11+ FILE=" $ROOT /build.gradle"
12+
13+ OLD=" $( grep " ^version" " $FILE " | head -1 | awk -F" '" ' { print $2 }' ) "
14+ if [[ ! " $OLD " =~ ^([0-9]+)\. ([0-9]+)\. ([0-9]+)$ ]]; then
15+ echo " Cannot parse semver from '$OLD ' in $FILE " >&2
16+ exit 1
17+ fi
18+ MAJOR=" ${BASH_REMATCH[1]} "
19+ MINOR=" ${BASH_REMATCH[2]} "
20+ PATCH=" ${BASH_REMATCH[3]} "
21+
22+ case " $LEVEL " in
23+ patch) PATCH=$(( PATCH + 1 )) ;;
24+ minor) MINOR=$(( MINOR + 1 )) ; PATCH=0 ;;
25+ major) MAJOR=$(( MAJOR + 1 )) ; MINOR=0; PATCH=0 ;;
26+ esac
27+ NEW=" ${MAJOR} .${MINOR} .${PATCH} "
28+
29+ sed -i.bak " s/^version = '${OLD} '\$ /version = '${NEW} '/" " $FILE "
30+ rm " $FILE .bak"
31+
32+ cd " $ROOT "
33+ git add build.gradle
34+ git commit -m " Bump version: ${OLD} -> ${NEW} "
35+
36+ echo " Bumped $OLD -> $NEW and committed."
You can’t perform that action at this time.
0 commit comments