Skip to content

Commit 9c2cf40

Browse files
committed
Add release dev script-a
1 parent 7c05784 commit 9c2cf40

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

dev-bin/release.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
set -eu -o pipefail
4+
5+
changelog=$(cat CHANGELOG.md)
6+
7+
regex='
8+
## v([0-9]+\.[0-9]+\.[0-9]+) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\)
9+
10+
((.|
11+
)*)
12+
'
13+
14+
if [[ ! $changelog =~ $regex ]]; then
15+
echo "Could not find date line in change log!"
16+
exit 1
17+
fi
18+
19+
version="${BASH_REMATCH[1]}"
20+
date="${BASH_REMATCH[2]}"
21+
notes="$(echo "${BASH_REMATCH[3]}" | sed -n -E '/^## v[0-9]+\.[0-9]+\.[0-9]+/,$!p')"
22+
23+
echo "$notes"
24+
if [[ "$date" != "$(date +"%Y-%m-%d")" ]]; then
25+
echo "$date is not today!"
26+
exit 1
27+
fi
28+
29+
tag="v$version"
30+
31+
if [ -n "$(git status --porcelain)" ]; then
32+
echo ". is not clean." >&2
33+
exit 1
34+
fi
35+
36+
perl -pi -e "s/(?<=VERSION = \').+?(?=\')/$version/g" lib/minfraud/version.rb
37+
38+
echo $"Test results:"
39+
40+
rake
41+
42+
echo $'\nDiff:'
43+
git diff
44+
45+
echo $'\nRelease notes:'
46+
echo "$notes"
47+
48+
read -e -p "Commit changes and push to origin? " should_push
49+
50+
if [ "$should_push" != "y" ]; then
51+
echo "Aborting"
52+
exit 1
53+
fi
54+
55+
git commit -m "Update for $tag" -a
56+
57+
git push
58+
59+
gh release create --target "$(git branch --show-current)" -t "$version" -n "$notes" "$tag"

0 commit comments

Comments
 (0)