-
Notifications
You must be signed in to change notification settings - Fork 1
/
release.sh
executable file
·51 lines (39 loc) · 1.11 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
git fetch
currentBranch=$(git branch --show-current)
if [ "${currentBranch}" != 'main' ]
then
echo "Not on main, exiting"
exit 1
fi
diff=$(git diff origin/main --name-only)
if [ "${diff}" != '' ]
then
echo "Non-zero diff with origin, exiting"
exit 2
fi
# Get the latest tag, so we know what the next one will be
currentVersion=$(git describe --abbrev=0)
DATE=$(date "+%Y-%m-%d")
# Replace vx.x.x with the next version
read -p "Enter next version number (current: ${currentVersion}): " NEXT_VERSION
if [ "${NEXT_VERSION:0:1}" != 'v' ]
then
NEXT_VERSION="v${NEXT_VERSION}"
fi
echo
echo
echo "=========="
echo
echo "Tagging version ${NEXT_VERSION} with message \"Deploying on ${DATE}\""
echo
read -p "Press enter to continue... (Ctrl+C to cancel)" go
git tag -a ${NEXT_VERSION} -m "Deploying on ${DATE}"
git push origin $NEXT_VERSION
read -p 'Generate changelog? Enter to contine or Ctrl+C to quit'
git checkout -b changelog-$NEXT_VERSION
bundle
rake changelog
git add CHANGELOG.md
git commit -m "Generated changelog for $NEXT_VERSION"
git push --set-upstream origin changelog-$NEXT_VERSION