- PR means BitBucket's pull request.
- Version suffixes, like
-SNAPSHOT
or-RC
or-build
are not used. - Git must be installed and be in the PATH.
- Git tag format must be only version number. Any prefixes or suffixes are not allowerd.
- Developer must start from
master
branch. - Developer must work on
feature
branch.- The name of the branch must be short, yet must describe the purpose of the changes.
- Multiple words must be separated with hyphen, not underscore.
- Developer must commit a
/.version.bump
file.- File must contain one of 3 words,
major
,minor
orpatch
, to indicate which version should be bumped.
- File must contain one of 3 words,
- Developer must checkout
release_UNIQUE_ID
branch from latest availablemaster
branch. This step should be done immediately before PR creation. Possibly, script should exist in project's directory to complete this step with as few manual steps as possible.- Id should be unique, yet able to generate in deterministic manner as it will be used multiple times in independent pipeline steps.
- Developer must create PR from
master
torelease_UNIQUE_ID
branch. For the sake of simplicity let's assume feature is implemented properly and PR has got accepted. - Developer must merge PR which will merge and push to
release_UNIQUE_ID
branch. - On push to
release_UNIQUE_ID
the following steps must be executed by CI.- Script must check if
/.version.bump
exists. If not, job must fail. - Script must get the current version number from
/.version
file. If file doesn't exist, current version must be0.0.1
. If can't be read, job must fail. - Script must generate new version number using
/.version.bump
file content.- If current version is
0.0.1
, file's content must not bepatch
. If it is, job must fail. A0.0.1
is not allowed in SemVer but after major or minor increase it becomes1.0.0
or0.1.0
, respectively, which are allowed. - If file's content is
major
, increase major number and reset minor and patch numbers to zero. - If file's content is
minor
, do not change major number, increase minor number, and reset patch number to zero. - If file's content is
patch
, do not change major and minor numbers and increase patch number.
- If current version is
- Script must update version number to new one in
/readme.md
file. - Script must update
/changelog.md
file (See: Keep a changelog for the spec.) If file doesn't exist, can't be read, job must fail.- Script must change 'Unreleased' section title with new version and today's date. If section doesn't exist, job must fail.
- Script must add reference URL in the bottom, to have a new version pointing to changes between new and previous version.
- Script must write new version to
/.version
file overwriting existing file. Create file if not exists. - Script must delete
/.version.bump
file. - Script must commit changes with message
Bump version to NEW_VERSION
. WhereNEW_VERSION
is new version number. - Script must set Git tag with new version.
- Script must merge
release_UNIQUE_ID
tomaster
branch. If fails, job must fail. - Script must push
master
branch. If fails, job must fail. - Script must delete
release_UNIQUE_ID
branch. If fails, job must display warning.
- Script must check if
- On push to
master
the following steps must be executed by CI.- Script must check if
/.version.bump
exists. If yes, job must fail. - Script must get version from
/.version
file. If file doesn't exists or can't be read, job must fail. - Script must check if Git tag above version exists. If yes, job must fail.
- Gradle must build, run tests, publish to Nexus.
- Gradle script must set
version
property to a content of/.version
file.
- Gradle script must set
- Script must check if