github.com/stackdocker/rkt@v0.10.1-0.20151109095037-1aa827478248/scripts/bump-release (about) 1 #!/bin/bash -e 2 # 3 # Attempt to bump the rkt release to the specified version by replacing all 4 # occurrences of the current/previous version. 5 # 6 # Generates two commits: the release itself and the bump to the next +git 7 # version 8 # 9 # YMMV, no disclaimer or warranty, etc. 10 11 if ! [[ "$1" =~ ^v[[:digit:]]+.[[:digit:]]+.[[:digit:]]$ ]]; then 12 echo "Usage: scripts/bump-release <VERSION>" 13 echo " where VERSION must be vX.Y.Z" 14 exit 255 15 fi 16 17 function replace_all() { 18 REPLACE=$(sed -e 's/[]\/$*.^|[]/\\&/g'<<< $1) 19 git ls-files | grep -Ev "(CHANGELOG.md|Godeps)" | xargs sed -i --follow-symlinks -e "s/$REPLACE/$2/g" 20 } 21 22 function replace_version() { 23 REPLACE=$(sed -e 's/[]\/$*.^|[]/\\&/g'<<< $1) 24 sed -i -e "s/$REPLACE/$2/g" configure.ac 25 } 26 27 NEXT=${1:1} # 0.2.3 28 NEXTGIT="${NEXT}+git" # 0.2.3+git 29 30 PREVGIT=$(grep -Po 'AC_INIT\(\[rkt\], \[\K[^\]]*(?=])' configure.ac) # 0.1.2+git 31 PREV=${PREVGIT::-4} # 0.1.2 32 33 replace_version $PREVGIT $NEXT 34 replace_all $PREV $NEXT 35 git commit -am "version: bump to v${NEXT}" 36 37 replace_version $NEXT $NEXTGIT 38 git commit -am "version: bump to v${NEXTGIT}"