Skip to content

Commit 99ba43b

Browse files
authored
Merge pull request #83 from zalando-stups/58-auto-versions-with-travis
#58 switching to a more manual way, but without pitfalls
2 parents 092969b + 060366d commit 99ba43b

File tree

2 files changed

+41
-30
lines changed

2 files changed

+41
-30
lines changed

Makefile

+4-19
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ docker_tag ?= zalando-stups/skrop
55

66
CURRENT_VERSION = $(shell git describe --tags --always --dirty)
77
VERSION ?= $(CURRENT_VERSION)
8-
NEXT_MAJOR = $(shell go run packaging/version/version.go major $(CURRENT_VERSION))
9-
NEXT_MINOR = $(shell go run packaging/version/version.go minor $(CURRENT_VERSION))
108
NEXT_PATCH = $(shell go run packaging/version/version.go patch $(CURRENT_VERSION))
119
COMMIT_HASH = $(shell git rev-parse --short HEAD)
1210

@@ -43,36 +41,23 @@ tag:
4341
push-tags:
4442
git push --tags https://$(GITHUB_AUTH)@github.com/zalando-stups/skrop
4543

46-
release-major:
47-
echo Incrementing major version
48-
make VERSION=$(NEXT_MAJOR) tag push-tags
49-
50-
release-minor:
51-
echo Incrementing minor version
52-
make VERSION=$(NEXT_MINOR) tag push-tags
53-
5444
release-patch:
55-
echo Incrementing patch version
45+
echo "Incrementing patch version"
5646
make VERSION=$(NEXT_PATCH) tag push-tags
5747

5848
ci-user:
5949
git config --global user.email "[email protected]"
6050
git config --global user.name "Travis CI"
6151

62-
ci-release-major: ci-user init-deps release-major
63-
ci-release-minor: ci-user init-deps release-minor
6452
ci-release-patch: ci-user init-deps release-patch
6553

6654
ci-test:
6755
./.travis/test.sh
6856

6957
ci-trigger: ci-test
70-
ifeq ($(TRAVIS_BRANCH)_$(TRAVIS_PULL_REQUEST)_$(findstring major-release,$(TRAVIS_COMMIT_MESSAGE)), master_false_major-release)
71-
make ci-release-major
72-
else ifeq ($(TRAVIS_BRANCH)_$(TRAVIS_PULL_REQUEST)_$(findstring minor-release,$(TRAVIS_COMMIT_MESSAGE)), master_false_minor-release)
73-
make ci-release-minor
74-
else ifeq ($(TRAVIS_BRANCH)_$(TRAVIS_PULL_REQUEST), master_false)
58+
ifeq ($(TRAVIS_BRANCH)_$(TRAVIS_PULL_REQUEST), master_false)
59+
echo "Merge to 'master'. Tagging patch version up."
7560
make ci-release-patch
7661
else
77-
echo Not a merge to 'master'. Not versionning this merge.
62+
echo "Not a merge to 'master'. Not versionning this merge."
7863
endif

README.md

+37-11
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,43 @@ env:
168168
- secure: "someBASE64value"
169169
```
170170
171-
### Versioning
172-
173-
This project uses [semantic versioning](https://semver.org/). The version is bumped up automatically at
174-
every merge to master (by [_Travis CI_](/.travis.yml)).
175-
176-
To control which part of the version is bumped up, the commit message of the merge commit (including the first line
177-
of the commit message of all commits it consist of) has to include a special part.
178-
- `major-release`: the first digit (the major version) will be incremented. Example: from `3.23.291` to `4.0.0`.
179-
- `minor-release`: the second digit (the minor version) will be incremented. Example: from `3.23.291` to `3.24.0`.
180-
- anything else not including one of the text above will result in the third digit (the patch version) to be incremented.
181-
Example: `3.23.291` to `3.23.292`.
171+
## Versioning
172+
173+
This project uses [semantic versioning](https://semver.org/).
174+
175+
The patch-version (3rd digit) is bumped up automatically at every merge to master (by [_Travis CI_](/.travis.yml)).
176+
177+
### Increment the patch version
178+
This is done automatically by _Travis CI_. Nothing special to do here. Example: merging when latest tag is `v3.23.291`
179+
will automaticall tag a version `v3.23.292`.
180+
181+
### Increment the minor version
182+
Since _Travis CI_ only automatically increases the patch-version, we need to manually pre-tag with the new version we
183+
want.
184+
185+
Scenario:
186+
- actual version is `v3.23.291`
187+
- tag one of the commit on your branch with the new version you want.
188+
- it is **important** that the patch version be `-1`, since it will be incremented automatically by _Travis CI_.
189+
- `git tag v3.24.-1 && git push --tags`
190+
- open the pull request.
191+
- after merge, _Travis CI_ will tag automatically the right final version `v3.24.0`.
192+
- delete the temporary manual tag
193+
- `git tag -d v3.24.-1 && git push --tags`
194+
195+
### Increment the major version
196+
Since _Travis CI_ only automatically increases the patch-version, we need to manually pre-tag with the new version we
197+
want.
198+
199+
Scenario:
200+
- actual version is `v3.23.291`
201+
- tag one of the commit on your branch with the new version you want.
202+
- it is **important** that the patch version be `-1`, since it will be incremented automatically by _Travis CI_.
203+
- `git tag v4.0.-1 && git push --tags`
204+
- open the pull request.
205+
- after merge, _Travis CI_ will tag automatically the right final version `v4.0.0`.
206+
- delete the temporary manual tag
207+
- `git tag -d v4.0.-1 && git push --tags`
182208

183209

184210
## License

0 commit comments

Comments
 (0)