CaGe-graph / CaGe

The Chemical and abstract Graph environment
9 stars 2 forks source link

rewrite tag-release.sh for git #4

Open nvcleemp opened 10 years ago

nvcleemp commented 10 years ago

Currently this script works for subversion. It should be rewritten for git.

It should verify that the tag doesn't already exist. Some sample code that could be helpful is this:

#!/bin/bash

set -e #fail on error

tag_already_exists() {
    echo Verifying tag does not exist: "$1"
    if git show-ref --tags --quiet --verify -- "refs/tags/$1"
    then
        echo Git tag "$1" already exists locally....
        return 0
    else
        echo Git tag "$1" does not yet exist....
        return 1
    fi
}

if ! tag_already_exists $2
then
    echo OK
else
    echo Error
fi

or

git ls-remote --tags 2>/dev/null | grep "refs/tags/2013-05-28$"

It should also verify that the current repository is not behind or diverged from the origin. If this is the case, than a pull should be done first. If the current repository is behind, than this is not a problem. Some useful information might be here: http://stackoverflow.com/questions/3258243/git-check-if-pull-needed

nvcleemp commented 10 years ago

The steps necessary to create a release are simple: