| peusterm | 33bbc84 | 2017-09-04 16:34:09 +0200 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | # Tag and push a release. |
| 3 | |
| 4 | set -e |
| 5 | |
| 6 | # Make sure we're in the project root. |
| 7 | |
| 8 | cd $(dirname "$0")/.. |
| 9 | |
| 10 | # Make sure the darn thing works |
| 11 | |
| 12 | bundle update |
| 13 | |
| 14 | # Build a new gem archive. |
| 15 | |
| 16 | rm -rf jekyll-theme-cayman-*.gem |
| 17 | gem build -q jekyll-theme-cayman.gemspec |
| 18 | |
| 19 | # Make sure we're on the master branch. |
| 20 | |
| 21 | (git branch | grep -q 'master') || { |
| 22 | echo "Only release from the master branch." |
| 23 | exit 1 |
| 24 | } |
| 25 | |
| 26 | # Figure out what version we're releasing. |
| 27 | |
| 28 | tag=v`ls jekyll-theme-cayman-*.gem | sed 's/^jekyll-theme-cayman-\(.*\)\.gem$/\1/'` |
| 29 | |
| 30 | # Make sure we haven't released this version before. |
| 31 | |
| 32 | git fetch -t origin |
| 33 | |
| 34 | (git tag -l | grep -q "$tag") && { |
| 35 | echo "Whoops, there's already a '${tag}' tag." |
| 36 | exit 1 |
| 37 | } |
| 38 | |
| 39 | # Tag it and bag it. |
| 40 | |
| 41 | gem push jekyll-theme-cayman-*.gem && git tag "$tag" && |
| 42 | git push origin master && git push origin "$tag" |