File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed
Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change 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 $' \n Diff:'
43+ git diff
44+
45+ echo $' \n Release 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 "
You can’t perform that action at this time.
0 commit comments