In our continuous integration system, we mark the last good build in the last step which is executed only if the test suite passed.
tag-ok-build.sh
#!/bin/bash
# Error on 1'st failure
set -e
tag=last-green-build
revision=$(git rev-parse HEAD)
echo "Tagging $commit as $tag"
git tag -f $tag $commit
git pull origin master
git push --tags origin master
To deploy, we use the following script who also tags the last deployed version.
deploy.sh
#!/bin/bash
# Deploy, meaning sync from last successful build
tag=last-green-build
# Fetch get the latest changes from remote but does not update working
# directory, just the index
git fetch --tags
# Merge to the last successful bulid
git merge ${tag}
# Tag currently deployed revision
git tag -f deployed ${tag}
git push --tags
1 comment:
Nice auto tagging.
yea yea, its me again.
Post a Comment