forked from lukas-epidemic/semver-release-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·39 lines (30 loc) · 1.28 KB
/
entrypoint.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/sh -l
set -u
if [ -z "${GITHUB_TOKEN}" ]
then
echo "The GITHUB_TOKEN environment variable is not defined."
exit 1
fi
RELEASE_BRANCH="$1"
RELEASE_STRATEGY="$2"
NEXT_TAG="$3"
TAG_FORMAT="$4"
echo ::Executing bumper guard ::debug release_branch=${RELEASE_BRANCH},github_event_path=${GITHUB_EVENT_PATH}
/bumper guard "${RELEASE_BRANCH}" "${GITHUB_EVENT_PATH}"
if [ $? -eq 78 ]
then
echo ::debug ::Guard returned a neutral code, stopping the execution.
exit 0
fi
if [ -z "${NEXT_TAG}" ]
then
echo ::debug ::Executing bumper latest-tag github_repository=${GITHUB_REPOSITORY}
LATEST_TAG=$(/bumper latest-tag "${GITHUB_REPOSITORY}" "${GITHUB_TOKEN}")
echo ::debug ::Executing bumper increment github_event_path=${GITHUB_EVENT_PATH}
INCREMENT=$(/bumper increment "${GITHUB_EVENT_PATH}")
echo ::debug ::Executing bumper semver latest_tag=${LATEST_TAG},increment=${INCREMENT}
NEXT_TAG=$(/bumper semver "${LATEST_TAG}" "${INCREMENT}" "${TAG_FORMAT}")
fi
echo ::debug ::Executing bumper release github_repository=${GITHUB_REPOSITORY},github_sha=${GITHUB_SHA},next_tag=${NEXT_TAG},strategy=${RELEASE_STRATEGY}
/bumper release --strategy "${RELEASE_STRATEGY}" "${GITHUB_REPOSITORY}" "${GITHUB_SHA}" "${NEXT_TAG}" "${GITHUB_TOKEN}"
echo ::set-output name=tag::${NEXT_TAG}