Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ jobs:
else
echo "[INFO] No existing tags detected for $VERSION"
fi
- name: Login to docker.io
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
registry: docker.io
- name: Login to quay.io
uses: docker/login-action@v4
with:
Expand Down
49 changes: 31 additions & 18 deletions make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,35 @@ releaseMachineExec() {
echo "Pushed ${REGISTRY}/${ORGANIZATION}/${IMAGE}:${VERSION}"
}

commitChangeOrCreatePR()
{
if [[ ${NOCOMMIT} -eq 1 ]]; then
echo "[INFO] NOCOMMIT = 1; so nothing will be committed. Run this script with no flags for usage + list of flags/options."
else
aVERSION="$1"
aBRANCH="$2"
PR_BRANCH="$3"

COMMIT_MSG="release: bump to ${aVERSION} in ${aBRANCH}"

# commit change into branch
git add -A || true
git commit -s -m "${COMMIT_MSG}"
git pull origin "${aBRANCH}"

PUSH_TRY="$(git push origin "${aBRANCH}")"
# shellcheck disable=SC2181
if [[ $? -gt 0 ]] || [[ $PUSH_TRY == *"protected branch hook declined"* ]]; then
# create pull request for main branch, as branch is restricted
git branch "${PR_BRANCH}"
git checkout "${PR_BRANCH}"
git pull origin "${PR_BRANCH}"
git push origin "${PR_BRANCH}"
gh pr create -f -B "${aBRANCH}" -H "${PR_BRANCH}"
fi
fi
}

# derive branch from version
BRANCH=${VERSION%.*}.x

Expand All @@ -74,7 +103,6 @@ else
git fetch origin "${BRANCH}:${BRANCH}" || true
git checkout ${BRANCH}
fi
set -e

# change VERSION file
echo "${VERSION}" > VERSION
Expand All @@ -85,6 +113,7 @@ if [[ ${NOCOMMIT} -eq 0 ]]; then
git commit -s -m "${COMMIT_MSG}" VERSION
git pull origin "${BRANCH}"
git push origin "${BRANCH}"
commitChangeOrCreatePR "${VERSION}" "${BRANCH}" "pr-${BRANCH}-to-${NEXTVERSION}"
fi

if [[ $TRIGGER_RELEASE -eq 1 ]]; then
Expand Down Expand Up @@ -115,21 +144,5 @@ fi
# change VERSION file
echo "${NEXTVERSION}" > VERSION
if [[ ${NOCOMMIT} -eq 0 ]]; then
BRANCH=${BASEBRANCH}
# commit change into branch
COMMIT_MSG="chore: release: bump to ${NEXTVERSION} in ${BRANCH}"
git commit -s -m "${COMMIT_MSG}" VERSION
git pull origin "${BRANCH}"

PUSH_TRY="$(git push origin "${BRANCH}")"
# shellcheck disable=SC2181
if [[ $? -gt 0 ]] || [[ $PUSH_TRY == *"protected branch hook declined"* ]]; then
PR_BRANCH=pr-main-to-${NEXTVERSION}
# create pull request for main branch, as branch is restricted
git branch "${PR_BRANCH}"
git checkout "${PR_BRANCH}"
git pull origin "${PR_BRANCH}"
git push origin "${PR_BRANCH}"
gh pr create -f -B "${BRANCH}" -H "${PR_BRANCH}"
fi
commitChangeOrCreatePR "$NEXTVERSION" "$BASEBRANCH" pr-main-to-${NEXTVERSION}
fi
Loading