forked from mhl787156/starling-bake-build-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release_tag_cache.sh
executable file
·40 lines (35 loc) · 1.06 KB
/
release_tag_cache.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
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
VERSION="${BRANCH}"
RELEASE=""
CACHETO=""
CACHEFROM="cache-dev"
echo "Current branch is: ${BRANCH}"
IFS=',' read -ra branch <<< "${LATEST_BRANCHES}"
for b in "${branch[@]}"; do
echo "Is \"$b\" a match for ${BRANCH}"
if [[ "${BRANCH}" == "$b" ]]
then
VERSION="${TAG}"
RELEASE='latest'
CACHETO='cache'
CACHEFROM='cache'
echo "Branch is latest, set accordingly"
fi
done
IFS=',' read -ra devbranch <<< "${DEV_BRANCHES}"
for b in "${devbranch[@]}"; do
echo "Is \"$b\" a match for ${BRANCH}"
if [[ "${BRANCH}" == "$b" ]]
then
VERSION='nightly'
CACHETO='cache-dev'
CACHEFROM='cache-dev'
echo "Branch is dev, caches set accordingly"
break;
fi
done
echo "Version: ${VERSION}, Release: ${RELEASE}, CACHETO: ${CACHETO}, CACHEFROM: ${CACHEFROM}"
echo ::set-output name=release::"${RELEASE}"
echo ::set-output name=version::"${VERSION}"
echo ::set-output name=cacheto::"${CACHETO}"
echo ::set-output name=cachefrom::"${CACHEFROM}"