From 4d5851b3b32efc3e382d97ef1d56a87bb2595e8e Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 28 Jun 2016 15:24:23 +0200 Subject: [PATCH] fix: Custom version by argument --- bump.sh | 9 ++++++--- version.sh | 6 +++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bump.sh b/bump.sh index 132890aa..3facbe9a 100755 --- a/bump.sh +++ b/bump.sh @@ -1,16 +1,19 @@ #!/bin/sh # Use passed argument as new tag -[ $# -eq 1 ] && git tag "$@" - -./version.sh +[ $# -eq 1 ] && { + git tag "$@" || exit 1 +} # shellcheck disable=SC2016 tag_prev=$(git tag -l | tail -2 | head -1) tag_curr=$(git tag -l | tail -1) +./version.sh "$tag_curr" + sed -r "s/${tag_prev}/${tag_curr}/g" -i README.md CMakeLists.txt contrib/lemonbuddy.aur/PKGBUILD contrib/lemonbuddy.aur/.SRCINFO git add README.md CMakeLists.txt contrib/lemonbuddy.aur/PKGBUILD contrib/lemonbuddy.aur/.SRCINFO +git add -u include/version.hpp git commit -m "build: Bump version to ${tag_curr}" # Recreate the tag to include the last commit diff --git a/version.sh b/version.sh index 74968096..a2428f66 100755 --- a/version.sh +++ b/version.sh @@ -5,7 +5,11 @@ msg() { } main() { - version="$(git describe --tags --dirty=-dev)" + version="$1" + + [ "$version" ] || { + version="$(git describe --tags --dirty=-dev)" + } msg "Current version: ${version}"