2020-03-10 16:48:39 -05:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
GIT_RELEASE_BOT_NAME=${GIT_RELEASE_BOT_NAME:?GIT_RELEASE_BOT_NAME must be provided}
|
|
|
|
GITHUB_SHA=${GITHUB_SHA:?GITHUB_SHA must be provided}
|
|
|
|
GITHUB_REF=${GITHUB_REF:?GITHUB_REF must be provided}
|
2020-12-14 11:02:49 -06:00
|
|
|
RELEASE_BRANCH_PATTERN=${RELEASE_BRANCH_PATTERN:?RELEASE_BRANCH_PATTERN must be provided}
|
2020-12-07 13:37:28 -06:00
|
|
|
PRERELEASE_BRANCH_PATTERN=${PRERELEASE_BRANCH_PATTERN:?PRERELEASE_BRANCH_PATTERN must be provided}
|
|
|
|
|
2020-05-05 12:48:16 -05:00
|
|
|
#git rev-parse --abbrev-ref HEAD
|
2020-03-10 16:48:39 -05:00
|
|
|
|
|
|
|
# Filter the branch to execute the release on
|
2020-05-05 12:48:16 -05:00
|
|
|
readonly local current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
echo "Current branch: ${current_branch}"
|
2020-12-14 10:42:50 -06:00
|
|
|
|
|
|
|
if [[ -n "${current_branch}" && "${current_branch}" == *"${RELEASE_BRANCH_PATTERN}"* ]]; then
|
2021-04-01 11:40:53 -05:00
|
|
|
echo "Building for release branch ${current_branch}"
|
2020-12-07 13:37:28 -06:00
|
|
|
elif [[ -n "${current_branch}" && "${current_branch}" == *"${PRERELEASE_BRANCH_PATTERN}"* ]]; then
|
2021-04-01 11:40:53 -05:00
|
|
|
echo "Building prerelease for branch ${current_branch}"
|
|
|
|
else
|
2020-05-05 12:48:16 -05:00
|
|
|
echo "Skipping for ${current_branch} branch"
|
2020-03-10 16:48:39 -05:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Making sure we are on top of the branch
|
|
|
|
echo "Git checkout branch ${GITHUB_REF##*/}"
|
|
|
|
git checkout ${GITHUB_REF##*/}
|
|
|
|
echo "Git reset hard to ${GITHUB_SHA}"
|
|
|
|
git reset --hard ${GITHUB_SHA}
|
|
|
|
|
|
|
|
# Do the release
|
|
|
|
echo "Do mvn release:prepare..."
|
|
|
|
#mvn $MAVEN_REPO_LOCAL --batch-mode --global-settings release.xml -Dusername=$GITHUB_ACCESS_TOKEN release:prepare
|
2020-03-10 22:00:14 -05:00
|
|
|
mvn --batch-mode --global-settings release.xml -Dusername=$GITHUB_ACCESS_TOKEN clean release:prepare -DdevelopmentVersion=${NEXT_SNAPSHOT} -DreleaseVersion=${RELEASE_VERSION}
|
2020-03-10 16:48:39 -05:00
|
|
|
|
2020-08-11 10:26:31 -05:00
|
|
|
echo "files after release:prepare..."
|
|
|
|
pwd
|
|
|
|
ls -l
|