-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·34 lines (26 loc) · 1.04 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
#!/bin/bash -l
# Execute dotnet-gitversion and store the output
OUTPUT=$(/tools/dotnet-gitversion)
# Extract branch name from Github environment variable
BRANCH_NAME=$(echo "$GITHUB_HEAD_REF" | sed 's/features\///')
# Parse JSON and extract the version information
SemVer=$(echo "$OUTPUT" | jq -r .MajorMinorPatch)
PRE_RELEASE=$(echo "$OUTPUT" | jq -r .PreReleaseNumber)
## Determine if prod flag is true
if [ "${INPUT_PROD}" == "true" ]; then
echo "Building with Production Versioning"
VERSION="${SemVer}"
GIT_VERSION="v${SemVer}"
else
echo "Building without Production Versioning"
VERSION="${SemVer}-${BRANCH_NAME}.${PRE_RELEASE}"
GIT_VERSION="v${SemVer}-${BRANCH_NAME}.${PRE_RELEASE}"
fi
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "BRANCH_NAME: ${BRANCH_NAME}"
echo "PRODUCTION_BUILD=${INPUT_PROD}" >> "$GITHUB_OUTPUT"
echo "PRODUCTION_BUILD: ${INPUT_PROD}"
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
echo "VERSION: ${VERSION}"
echo "GIT_VERSION=${GIT_VERSION}" >> "$GITHUB_OUTPUT"
echo "GIT_VERSION: ${GIT_VERSION}"