-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_release_branch.sh
executable file
·39 lines (30 loc) · 1.05 KB
/
create_release_branch.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
#!/bin/bash
# This creates a new release branch off of production, merges it with main,
# and creates a new pull request for that branch.
skip_branch_creation='false'
while getopts ":h" opt; do
case $opt in
h )
echo "Usage:"
echo " refresh.sh -h Display this help message."
exit 0
;;
\? ) echo "Usage: cmd [-h]"
;;
esac
done
# Ensure working directory in version branch clean
git update-index -q --refresh
if ! git diff-index --quiet HEAD --; then
echo "Working directory not clean, please commit your changes first"
exit
fi
formatted_date=$(date +'%m-%d-%Y')
branch_name="release-$formatted_date"
echo "Checking out and updating to the latest main"
git checkout main && git pull --rebase origin main
echo "Checking out new branch off main: $branch_name"
git checkout -b $branch_name
echo "Pushing branch to Github and opening the compare view in browser."
git push origin -u $branch_name
open "https://github.com/SFDigitalServices/sf-dahlia-lap/compare/production...$branch_name?expand=1";