Skip to content

Commit 2052e36

Browse files
committed
Add release script
1 parent 335852b commit 2052e36

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

Diff for: script/release

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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-slate-*.gem
17+
gem build -q jekyll-theme-slate.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-slate-*.gem | sed 's/^jekyll-theme-slate-\(.*\)\.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-slate-*.gem && git tag "$tag" &&
42+
git push origin master && git push origin "$tag"

0 commit comments

Comments
 (0)