forked from RedHatInsights/curiosity-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_release.sh
executable file
·63 lines (58 loc) · 1.57 KB
/
custom_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
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
#
#
# Release a branch. APP_BUILD_DIR should be updated at the Travis configuration level.
release()
{
local DEPLOY_BRANCH=$1
local BUILD_DIR=$APP_BUILD_DIR
printf "${YELLOW}PUSHING ${DEPLOY_BRANCH}${NOCOLOR}\n"
rm -rf "./${BUILD_DIR}/.git"
.travis/release.sh "${DEPLOY_BRANCH}"
printf "${GREEN}COMPLETED ${DEPLOY_BRANCH}${NOCOLOR}\n"
}
#
#
# CI/Dev beta release for "ci" and "qa" "beta" and "stable" branches, based on deploy stage name
#
releaseDev()
{
if [[ "${TRAVIS_BRANCH}" = "ci-beta" || "${TRAVIS_BRANCH}" = "dev" || "${TRAVIS_BRANCH}" = "ci" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
release "ci-beta"
release "qa-beta"
fi
if [[ "${TRAVIS_BRANCH}" = "ci-stable" || "${TRAVIS_BRANCH}" = "test" || "${TRAVIS_BRANCH}" = "qa" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
release "ci-stable"
release "qa-stable"
fi
}
#
#
# Prod release for "main" and "stage" branches based on deploy stage name.
#
releaseProd()
{
if [[ "${TRAVIS_BRANCH}" = "prod-beta" || "${TRAVIS_BRANCH}" = "stage" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
release "prod-beta"
fi
if [[ "${TRAVIS_BRANCH}" = "prod-stable" || "${TRAVIS_BRANCH}" = "prod" || "${TRAVIS_BRANCH}" = "main" || "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
if [[ "${TRAVIS_COMMIT_MESSAGE}" = *"chore(release):"* ]]; then
release "prod-stable"
fi
fi
}
#
#
# main()
#
{
set -e
set -x
BLUE="\e[34m"
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
NOCOLOR="\e[39m"
releaseDev
releaseProd
}