-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreleaseToMaster.bash
executable file
·64 lines (44 loc) · 1.77 KB
/
releaseToMaster.bash
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
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#
# Copyright (c) 2021. wink.travel. All rights Reserved.
#
echo "Releasing iam-sdk-java..."
echo "Sync-ing remote master with local"
git checkout master
git pull
git checkout develop
echo "Retrieving next version number..."
newVersion=`npx git-changelog-command-line --print-next-version --major-version-pattern BREAKING --minor-version-pattern feat`
read -p "Do you want to proceed with version $newVersion? (y/n) " yn
case $yn in
[yY] ) echo "New semantic version using Conventional Commits: $newVersion"
mvn versions:set -DnewVersion="$newVersion-SNAPSHOT" -DgenerateBackupPoms=false
git commit -a -m ":bookmark: build: Committing updated pom.xml files and CHANGELOG.md."
echo "Starting release process..."
mvn -B gitflow:release-start gitflow:release-finish -DskipTestProject=true
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "Something went wrong on line: ${BASH_LINENO[*]}"
exit 1
fi
echo "Release complete. Cleaning up..."
echo "Pushing master to origin"
git checkout master
echo "Updating CHANGELOG.md..."
npx git-changelog-command-line -of CHANGELOG.md
git commit -a -m ":memo: doc: Updated CHANGELOG.md..."
git push origin master:refs/heads/master
echo "Creating GitHub release..."
gh release create v$newVersion --notes "See CHANGELOG.md for release notes" --target master
git checkout develop
echo "Merging CHANGELOG.md from master..."
git merge master --no-edit -m ":twisted_rightwards_arrows: doc: merged CHANGELOG.md from master into develop branch" --strategy-option theirs
echo "Pushing develop to origin"
git push origin develop:refs/heads/develop
exit;;
[nN] ) echo "Exiting...";
exit;;
* ) echo "Invalid response";
exit 1;;
esac
echo "Release SUCCESS"