Created
November 7, 2013 19:18
-
-
Save simonda86/7360328 to your computer and use it in GitHub Desktop.
Watch a file for updates to version number and then automatically adds a git tag
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
#!/bin/bash | |
# Options | |
file="style.css" | |
prefix="Version:" | |
# Do not edit below | |
tag=$(git tag | tail -1) | |
version=$(grep -F $prefix $file) | |
version=${version##*:} | |
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d\n", $1,$2,$3); }'; } | |
if [ $(version $version) -gt $(version $tag) ]; then | |
# Tag git with the new version number | |
git tag $version | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment