-
-
Save emrahayanoglu/4988a63def99f195192d92d8c90d94d2 to your computer and use it in GitHub Desktop.
Release script to use Debian Changelog and Git together to generate the new version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# TYPE= argument to the script where 0 = MAJOR, 1 = MINOR, 2 = BUILD. Default to BUILD. | |
GIT_VERSION=$(git describe --tags) | |
CURRENT_VERSION=$(echo ${GIT_VERSION:1} | cut -d'-' -f1) | |
TYPE=${1:-2} | |
function increment_version() { | |
local VERSION="$1" | |
local PLACE="$2" | |
IFS='.' read -r -a a <<<"$VERSION" | |
((a[PLACE]++)) | |
echo "${a[0]}.${a[1]}.${a[2]}" | |
} | |
NEW_VERSION=$(increment_version $CURRENT_VERSION $TYPE) | |
dch -v $NEW_VERSION && git commit -p -m "Bump version $NEW_VERSION" && git tag v${NEW_VERSION} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment