forked from borisskert/release-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhotfix_start.sh
executable file
·53 lines (41 loc) · 1.28 KB
/
hotfix_start.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
52
53
#!/bin/bash
set -e
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -f "${SCRIPT_PATH}/.version.sh" ]; then
source ${SCRIPT_PATH}/.version.sh
else
VERSION="UNKNOWN VERSION"
fi
echo "Release scripts (hotfix-start, version: ${VERSION})"
if [ -f "${SCRIPT_PATH}/.common-util.sh" ]; then
source ${SCRIPT_PATH}/.common-util.sh
else
echo 'Missing file .common-util.sh. Aborting'
exit -1
fi
if [ $# -ne 1 ]
then
echo 'Usage: hotfix_start.sh <hotfix-version>'
echo 'For example:'
echo 'hotfix_start.sh 0.2.1'
exit 2
fi
HOTFIX_VERSION=$1
HOTFIX_SNAPSHOT_VERSION="${HOTFIX_VERSION}-SNAPSHOT"
HOTFIX_BRANCH=`format_hotfix_branch_name "${HOTFIX_VERSION}"`
check_local_workspace_state "hotfix_start"
git checkout ${MASTER_BRANCH} && git pull ${REMOTE_REPO}
git checkout -b ${HOTFIX_BRANCH}
set_modules_version ${HOTFIX_SNAPSHOT_VERSION}
cd ${GIT_REPO_DIR}
if ! is_workspace_clean
then
# commit hotfix versions
git commit -am "Start hotfix ${HOTFIX_SNAPSHOT_VERSION}"
else
echo "Nothing to commit..."
fi
echo "# Okay, now you've got a new hotfix branch called ${HOTFIX_BRANCH}"
echo "# Please check if everything looks as expected and then push."
echo "# Use this command to push your created hotfix-branch:"
echo "git push --set-upstream ${REMOTE_REPO} ${HOTFIX_BRANCH}"