Last active
July 23, 2020 18:23
-
-
Save oldsj/4243ad7f5bb32e14ebec0c1253fbf466 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
LATEST_RELEASE=$(hub release -L 1) | |
LATEST_BASE_VER=$(echo ${LATEST_RELEASE} | cut --delimiter . --fields 1) | |
LATEST_REVISION=$(echo ${LATEST_RELEASE} | cut --delimiter . --fields 2) | |
PROPOSED_BASE_VER=$(date +%Y%m%d) | |
PROPOSED_REVISION=1 | |
if [[ ${PROPOSED_BASE_VER} == ${LATEST_BASE_VER} ]] && \ | |
[[ ${PROPOSED_REVISION} -le ${LATEST_REVISION} ]]; then | |
while [[ ${PROPOSED_REVISION} -le ${LATEST_REVISION} ]]; do | |
PROPOSED_REVISION=$((PROPOSED_REVISION + 1)) | |
# there's probably an problem if there's more than 5 releases in a day | |
if [[ ${PROPOSED_REVISION} -gt 5 ]]; then | |
echo "Trying to create too many releases, exiting." | |
exit 1 | |
fi | |
done | |
PROPOSED_RELEASE=${PROPOSED_BASE_VER}.${PROPOSED_REVISION} | |
else | |
PROPOSED_RELEASE=${PROPOSED_BASE_VER}.${PROPOSED_REVISION} | |
fi | |
# get the tag of the BASE_REF and add -HF to it | |
if [[ ${BRANCH} == *"hotfix"* ]]; then | |
PROPOSED_RELEASE+="-HF" | |
fi | |
echo "Creating release: ${PROPOSED_RELEASE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment