Skip to content

Instantly share code, notes, and snippets.

@jlecour
Created October 9, 2011 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlecour/1274052 to your computer and use it in GitHub Desktop.
Save jlecour/1274052 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
# git name-rev is fail
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
if [ "master" = "${CURRENT}" ]
then
OUT='gem.out'
gem build my_gem.gemspec > $OUT
cat $OUT
PROJECT=`awk '{ if (NR == 2) { print $2; } }' $OUT`
VERSION=`awk '{ if (NR == 3) { print $2; } }' $OUT`
FILE=`awk '{ if (NR == 4) { print $2; } }' $OUT`
rm $OUT
echo "Fabrication de $FILE : OK"
gem inabox $FILE
echo "Publication dans le dépôt : OK"
git tag v$VERSION
git push --tags
echo "Tag Git : OK"
else
echo "Impossible de passer en production sans être sur 'master'"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment