Skip to content

Commit 525d301

Browse files
committed
ADD tool to release bash_unit quickly.
1 parent ff4be30 commit 525d301

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.swp
2+
token

release

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash -e
2+
3+
token_file=token
4+
5+
usage() {
6+
local message=$1
7+
8+
cat >&2 <<EOF
9+
$message
10+
11+
$0 <version>
12+
Publishes a new release of bash_unit on github.
13+
Version must respect [Semantic Versioning](http://semver.org/)
14+
A token file must exist in the current working directory. This file must be of the form:
15+
user=<user>
16+
token=<token>
17+
18+
<user> is your github account.
19+
<token> is your github api token. See https://github.com/settings/tokens
20+
EOF
21+
22+
exit 1
23+
}
24+
25+
version=$1
26+
27+
[[ -z $version ]] && usage "No version specified on command line"
28+
echo $version | grep -E '^v[0-9]*\.[0-9]*\.[0-9]*$' >/dev/null || usage "Invalid format for version: $version"
29+
[ -r $token_file ] || usage "$token_file file does not exist"
30+
31+
source $token_file
32+
33+
[[ -z $user ]] && usage "user not found in file $token_file"
34+
[[ -z $token ]] && usage "token not found in file $token_file"
35+
36+
curl -u $user:$token -XPOST https://api.github.com/repos/pgrange/bash_unit/releases -d "
37+
{
38+
\"tag_name\": \"$version\"
39+
}"

0 commit comments

Comments
 (0)