release-scripts [](https://travis-ci.com/borisskert/release-scripts)
September 3, 2019 ยท View on GitHub
release-scripts (also called Boris' magic scripts ๐) are designed to be used to perform software releases synchronously in multi-module mono-repositories despite of bunches of different technologies. Using release-scripts may redundantize plugins like maven-release-plugin.
Description
This scripts can help you if you have are working in a git-flow workflow on your project.
Especially the release and hotfix step of git-flow requires a lot commits and merge processes this scripts can help your out. Your can use them locally as well as in ci-pipelines.
Requirements
- bash terminal
- git version control
Integration
- checkout this repo
- copy all *.sh files into your project
- adjust
hooks.shfor your project environment
Integration as a submodule (recommended)
- Perform this steps in terminal:
$ git submodule add https://github.com/borisskert/release-scripts release-scripts
$ cp release-scripts/.hooks-default.sh .release-scripts-hooks.sh
- adjust
.release-scripts-hooks.shfor your project environment
Perform a standard release
with snapshot versions
$ ./release.sh <release-version> <snapshot-version>
# Perform next steps the script is telling
without snapshot versions
$ ./release.sh --no-snapshots <release-version>
# Perform next steps the script is telling
Usage
$ ./release.sh [-q|--(no-)quiet] [-v|--(no-)verbose] [-s|--(no-)snapshots] [-h|--help] <release-version> [<snapshot-version>]
Options
| Short option | Long option | Default | Description |
|---|---|---|---|
| -s | --(no-)snapshots | on | Turn on snapshots mode. If enabled the argument |
| -q | --(no-)quiet | off | Turn on quiet mode for automation |
| -v | --(no-)verbose | off | Turn on verbose mode for debugging |
Perform a hotfix release
Usage:
$ ./hotfix_start.sh [-q|--(no-)quiet] [-v|--(no-)verbose] [-s|--(no-)snapshots] [-h|--help] <hotfix-version>
and
$ ./hotfix_finish.sh [-q|--(no-)quiet] [-v|--(no-)verbose] [-s|--(no-)snapshots] [-h|--help] <hotfix-version> [<snapshot-version>]
with snapshot versions
$ ./hotfix_start.sh <hotfix-version>
# commit and push your work into the hotfix-branch
$ ./hotfix_finish.sh <hotfix-version> <snapshot-version>
without snapshot versions
$ ./hotfix_start.sh --no-snapshots <hotfix-version>
# commit and push your work into the hotfix-branch
$ ./hotfix_finish.sh --no-snapshots <hotfix-version>
Revert a (local) release
$ ./revert_release <release-version>
Support branches
If you need to make releases from support branches and also from develop, take care to adjust your hooks to calculate master and develop branches according to versions.
Example: For releasing versions that start with 12., i.e. 12.2 we'll use support-12.x branch, otherwise develop branch:
function get_develop_branch_name {
if [[ "\$1" =~ ^12\..* ]]
then
echo "support-12.x"
else
echo "develop"
fi
}
function get_master_branch_name {
if [[ "\$1" =~ ^12\..* ]]
then
echo "master-12.x"
else
echo "master"
fi
}
How to run unit tests over release scripts
- Install bats-core
- Go to tests directory
- Run
bats *.bats
How to run shellcheck
$ find . -maxdepth 1 -type f -name '*.sh' -print0 | xargs -0 shellcheck
Make sure you have installed shellcheck on your system.