2017-06-12 17:17:10 +02:00
|
|
|
#!/bin/sh
|
2017-08-03 02:13:19 +02:00
|
|
|
if [ ! -z "$TRAVIS_JOB_ID" ];
|
|
|
|
then
|
|
|
|
echo "Using Travis environment variables!"
|
|
|
|
TMP_JOBID="$TRAVIS_JOB_ID"
|
|
|
|
TMP_BRANCH="$TRAVIS_BRANCH"
|
|
|
|
TMP_PRID="$TRAVIS_PULL_REQUEST"
|
|
|
|
TMP_COMMIT="$TRAVIS_COMMIT"
|
|
|
|
elif [ ! -z "${APPVEYOR_JOB_ID}" ];
|
|
|
|
then
|
|
|
|
echo "Using AppVeyor environment variables!"
|
|
|
|
TMP_JOBID=$(echo "$APPVEYOR_JOB_ID" | sed 's/[^[:digit:]]\+//g')
|
|
|
|
TMP_BRANCH="$APPVEYOR_REPO_BRANCH"
|
|
|
|
TMP_PRID="$APPVEYOR_PULL_REQUEST_NUMBER"
|
|
|
|
TMP_COMMIT="$APPVEYOR_REPO_COMMIT"
|
2021-07-05 19:04:17 +02:00
|
|
|
elif [ ! -z "${GITHUB_RUN_ID}" ];
|
|
|
|
then
|
|
|
|
echo "Using Github environment variables!"
|
|
|
|
TMP_JOBID="$GITHUB_RUN_ID"
|
2021-07-27 20:26:17 +02:00
|
|
|
TMP_BRANCH=$(basename ${GITHUB_REF#refs/heads/})
|
2021-07-05 19:04:17 +02:00
|
|
|
TMP_PRID="$PULL_REQUEST"
|
|
|
|
TMP_COMMIT=$(git rev-parse --short "$GITHUB_SHA")
|
2017-08-03 02:13:19 +02:00
|
|
|
else
|
|
|
|
echo "No Travir or AppVeyor environment variables found!"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
VCMI_PACKAGE_FILE_NAME="${TMP_JOBID}-vcmi"
|
2017-06-12 17:17:10 +02:00
|
|
|
VCMI_PACKAGE_NAME_SUFFIX=""
|
2017-08-17 11:01:03 +02:00
|
|
|
if [ -z "$TMP_PRID" ] || [ "$TMP_PRID" == "false" ];
|
2017-06-12 17:17:10 +02:00
|
|
|
then
|
2017-08-03 02:13:19 +02:00
|
|
|
branch_name=$(echo "$TMP_BRANCH" | sed 's/[^[:alnum:]]\+/_/g')
|
|
|
|
VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-branch-${branch_name}-${TMP_COMMIT}"
|
2017-06-12 17:17:10 +02:00
|
|
|
VCMI_PACKAGE_NAME_SUFFIX="branch ${branch_name}"
|
|
|
|
else
|
2017-08-03 02:13:19 +02:00
|
|
|
VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-PR-${TMP_PRID}-${TMP_COMMIT}"
|
|
|
|
VCMI_PACKAGE_NAME_SUFFIX="PR ${TMP_PRID}"
|
2017-06-12 17:17:10 +02:00
|
|
|
fi
|
|
|
|
VCMI_PACKAGE_NAME_SUFFIX="(${VCMI_PACKAGE_NAME_SUFFIX})"
|
|
|
|
|
|
|
|
export VCMI_PACKAGE_FILE_NAME
|
|
|
|
export VCMI_PACKAGE_NAME_SUFFIX
|