Skip to content

Commit f0243e5

Browse files
authored
Merge pull request #3 from github/add-rubygems-release
Add script/release for rubygems release
2 parents 1871878 + 717b466 commit f0243e5

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

script/release

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
# Tag and push a release.
3+
4+
set -e
5+
set -x
6+
7+
# Make sure we're in the project root.
8+
9+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
10+
cd ${DIR}
11+
12+
# Build a new gem archive.
13+
14+
rm -rf entitlements-gitrepo-auditor-plugin-*.gem
15+
gem build -q entitlements-gitrepo-auditor-plugin.gemspec
16+
17+
# Make sure we're on the main branch.
18+
19+
(git branch --no-color | grep -q '* main') || {
20+
echo "Only release from the main branch."
21+
exit 1
22+
}
23+
24+
# Figure out what version we're releasing.
25+
26+
tag=v`ls entitlements-gitrepo-auditor-plugin-*.gem | sed 's/^entitlements-gitrepo-auditor-plugin-\(.*\)\.gem$/\1/'`
27+
28+
# Make sure we haven't released this version before.
29+
30+
git fetch -t origin
31+
32+
(git tag -l | grep -q "$tag") && {
33+
echo "Whoops, there's already a '${tag}' tag."
34+
exit 1
35+
}
36+
37+
# Tag it and bag it.
38+
39+
gem push entitlements-gitrepo-auditor-plugin-*.gem && git tag "$tag" &&
40+
git push origin main && git push origin "$tag"

0 commit comments

Comments
 (0)