diff --git a/.github/workflows/docker-build-api-executors-tag.yaml b/.github/workflows/docker-build-api-executors-tag.yaml index 5489fbbf76a..45ac2b7d34b 100644 --- a/.github/workflows/docker-build-api-executors-tag.yaml +++ b/.github/workflows/docker-build-api-executors-tag.yaml @@ -397,10 +397,10 @@ jobs: export GH_PUSH_TOKEN export RELEASE_VERSION - # Check if release branch exists + # Check if release branch exists in helm-charts repository REPO_OWNER=kubeshop REPO_NAME=helm-charts - RELEASE_BRANCH_NAME=release-$RELEASE_VERSION + RELEASE_BRANCH_NAME=release/$SERVICE/$RELEASE_VERSION echo $RELEASE_VERSION STATUS=$(curl -s -o /dev/null -w '%{http_code}' -H "${AUTH_HEADER}" "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/branches/${RELEASE_BRANCH_NAME}") @@ -408,15 +408,16 @@ jobs: git fetch origin main git checkout main cd ./scripts - ./chart_releaser.sh --helm-chart-folder testkube-api --testkube-executor true + ./chart_releaser.sh --helm-chart-folder testkube-$SERVICE --testkube-executor true else - git fetch origin "release-$RELEASE_VERSION" - git checkout "release-$RELEASE_VERSION" + git fetch origin "release/$SERVICE/$RELEASE_VERSION" + git checkout "release/$SERVICE/$RELEASE_VERSION" echo "Switched to release branch" cd ./scripts - ./chart_releaser.sh --helm-chart-folder testkube-api --testkube-executor true --branch true + ./chart_releaser.sh --helm-chart-folder testkube-$SERVICE --testkube-executor true --branch true fi env: + SERVICE: api GH_PUSH_TOKEN: ${{ secrets.CI_BOT_TOKEN }} RELEASE_VERSION: ${{ steps.tag.outputs.tag }} diff --git a/.github/workflows/docker-build-release.yaml b/.github/workflows/docker-build-release.yaml index 46fccf66aca..f83a20d4de2 100644 --- a/.github/workflows/docker-build-release.yaml +++ b/.github/workflows/docker-build-release.yaml @@ -2,7 +2,7 @@ name: Docker images build release on: push: branches: - - release-** + - release/** paths-ignore: - 'docs/**' @@ -390,19 +390,23 @@ jobs: # Set up variables for repository and branch name REPO_OWNER=kubeshop REPO_NAME=helm-charts - BRANCH_NAME=${GITHUB_REF} + OLD_BRANCH_NAME=${GITHUB_REF} + RELEASE_TAG=$(basename "${OLD_BRANCH_NAME}") + + # Set up the new branch name + NEW_BRANCH_NAME="refs/heads/release/operator/${RELEASE_TAG}" # Set up authentication using a personal access token AUTH_HEADER="Authorization: Bearer ${{ secrets.CI_BOT_TOKEN }}" # Check if branch already exists - STATUS=$(curl -s -o /dev/null -w '%{http_code}' -H "${AUTH_HEADER}" "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/branches/${BRANCH_NAME}") + STATUS=$(curl -s -o /dev/null -w '%{http_code}' -H "${AUTH_HEADER}" "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/branches/${NEW_BRANCH_NAME}") # If branch doesn't exist, create it if [ "${STATUS}" -eq 404 ]; then - curl -X POST -H "${AUTH_HEADER}" -d '{"ref": "'"${BRANCH_NAME}"'","sha": "'"$(curl -s -H "${AUTH_HEADER}" "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/git/refs/heads/main" | jq -r '.object.sha')"'"}' "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/git/refs" - echo "Created branch ${BRANCH_NAME} in ${REPO_OWNER}/${REPO_NAME}" + curl -X POST -H "${AUTH_HEADER}" -d '{"ref": "'"${NEW_BRANCH_NAME}"'","sha": "'"$(curl -s -H "${AUTH_HEADER}" "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/git/refs/heads/main" | jq -r '.object.sha')"'"}' "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/git/refs" + echo "Created branch ${NEW_BRANCH_NAME} in ${REPO_OWNER}/${REPO_NAME}" else - echo "Branch ${BRANCH_NAME} already exists in ${REPO_OWNER}/${REPO_NAME}" + echo "Branch ${NEW_BRANCH_NAME} already exists in ${REPO_OWNER}/${REPO_NAME}" fi