-
Notifications
You must be signed in to change notification settings - Fork 1
/
releaseToMaster.bash
executable file
·83 lines (58 loc) · 2.24 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
#
# Copyright (c) wink.travel 2022.
#
echo "Releasing new version of Wink WordPress plugin using git flow..."
versionNumber=$(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 $versionNumber? (y/n) " yn
case $yn in
[yY])
echo "Disabling git messages for a release"
export GIT_MERGE_AUTOEDIT=no
git cliff --unreleased --tag $versionNumber --sort newest
echo "Committing version changes for $versionNumber"
sed -i '' "s/Version.*/Version: $versionNumber/g" README.txt
sed -i '' "s/Stable tag.*/Stable tag: $versionNumber/g" README.txt
sed -i '' "s/Version.*/Version: $versionNumber/g" wink.php
git commit -a -m "build: arrow_up: bumping version and merging to master
Version bump to $versionNumber registered
Ops: $USER
"
git push --follow-tags origin develop
echo "Calling 'git flow release $versionNumber'"
git flow release start $versionNumber
echo "Calling 'git flow finish -m $versionNumber $versionNumber'"
git flow release finish -m $versionNumber $versionNumber
echo "Checking out master..."
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$versionNumber --notes "See CHANGELOG.md for release notes" --target master
echo "Pulling ORIGIN master into local branch..."
git pull origin
echo "Pushing master (+ tags) to ORIGIN..."
git push
echo "Checking out local develop branch..."
git checkout develop
echo "Pulling ORIGIN develop into local branch..."
git pull origin
echo "Merging CHANGELOG.md from master into develop..."
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
echo "Enabling git messages for a release again"
export GIT_MERGE_AUTOEDIT=yes
echo "Wink WordPress plugin $versionNumber has been successfully released"
;;
[nN])
echo "Exiting..."
exit
;;
*)
echo "Invalid response"
exit 1
;;
esac