Skip to content

Instantly share code, notes, and snippets.

@csgavino
Created August 28, 2013 04:44
Show Gist options
  • Save csgavino/6362215 to your computer and use it in GitHub Desktop.
Save csgavino/6362215 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ $# -gt 1 ]]; then
version=$1
echo $version > version.txt
echo "Bumped version to $version"
else
version=$(git describe --tags --always)
tokens=(${version//./ })
length=${#tokens[@]}
build_ver=${tokens[length-1]}
tokens[2]=$(($build_ver+1))
tokens=$(printf ".%s" "${tokens[@]}")
echo ${tokens:1} > version.txt
echo "Bumped version to ${tokens:1}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment