From 8b0c602545ec113dd669b4e50f03a717fc7ad072 Mon Sep 17 00:00:00 2001 From: Alex Lourie Date: Mon, 8 Dec 2025 10:25:15 +1030 Subject: [PATCH 1/4] Create a shell function to clear the release branch if it exists and always exit 0 Signed-off-by: Alex Lourie --- pipelines/scripts/common.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pipelines/scripts/common.sh b/pipelines/scripts/common.sh index 10c7a74..6f852a9 100755 --- a/pipelines/scripts/common.sh +++ b/pipelines/scripts/common.sh @@ -182,6 +182,15 @@ tag_finalize_version() { run git push --tags } +clear_release_branch() { + info "Clearing 'release' branch" + + git ls-remote --exit-code --heads origin release >/dev/null 2>&1 + if [[ $? == '0' ]]; then + run git push origin -d release + fi +} + check_tag_exists() { version=${1:? 'Version variable is missing.'} info "Checking remote tags if version exists..." From 18804675e63faa1ab57fce2c96554e52348e7a1a Mon Sep 17 00:00:00 2001 From: Alex Lourie Date: Tue, 9 Dec 2025 13:06:54 +1030 Subject: [PATCH 2/4] Proper release branch release Signed-off-by: Alex Lourie --- .github/workflows/build-docusaurus-pipeline.yml | 16 +++++----------- pipelines/basic/scripts/release-checks.sh | 12 ++---------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-docusaurus-pipeline.yml b/.github/workflows/build-docusaurus-pipeline.yml index 3fe9e14..09a8efa 100644 --- a/.github/workflows/build-docusaurus-pipeline.yml +++ b/.github/workflows/build-docusaurus-pipeline.yml @@ -74,11 +74,12 @@ jobs: container: zepben/pipeline-basic outputs: git_tag: ${{ steps.tags.outputs.git_tag }} + env: + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} steps: - - uses: actions/checkout@v4 with: - fetch-depth: 0 + token: ${{ env.GITHUB_TOKEN }} - name: Work around git permission issue run: | @@ -88,15 +89,8 @@ jobs: - name: Delete release branch run: | - # If the `release` branch already exists, remove it - # disable error failing - set +e - res=$(git push origin -d release) - if [ $? != 0 ]; then - echo "> [!NOTE] " >> "$GITHUB_STEP_SUMMARY" - echo "> :white_check_mark: Error while deleting 'release' branch in *parse-inputs* step, but that's probably OK. If nothing else failed, you're good." >> "$GITHUB_STEP_SUMMARY" - fi - continue-on-error: true + source /scripts/common.sh + clear_release_branch shell: bash - name: Create release branch diff --git a/pipelines/basic/scripts/release-checks.sh b/pipelines/basic/scripts/release-checks.sh index ff48813..bd0ae54 100755 --- a/pipelines/basic/scripts/release-checks.sh +++ b/pipelines/basic/scripts/release-checks.sh @@ -40,16 +40,8 @@ do fi done -info "Clearing the 'release' branch if it exists, ignore errors" -run git push origin -d release -# In most cases the error here means that the "release" branch doesn't exist. -# If that's not the case, one the following steps will fail, and will be handled -# manually, so we ignore the error here and only showing it. -if [ $status -ne 0 ]; then - # Show the error and continue - echo "Warning: There was an error deleting a release branch: " - cat "${output_file}" -fi +info "Clearing the 'release' branch if it exists" +clear_release_breanch # Get user name if [[ -z "$BITBUCKET_STEP_TRIGGERER_UUID" ]]; then From a3cc9b2f7edb96d184a587127ce05384181d33ce Mon Sep 17 00:00:00 2001 From: Alex Lourie Date: Tue, 9 Dec 2025 13:20:31 +1030 Subject: [PATCH 3/4] Fix script call Signed-off-by: Alex Lourie --- pipelines/basic/scripts/release-checks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/basic/scripts/release-checks.sh b/pipelines/basic/scripts/release-checks.sh index bd0ae54..1b344d7 100755 --- a/pipelines/basic/scripts/release-checks.sh +++ b/pipelines/basic/scripts/release-checks.sh @@ -41,7 +41,7 @@ do done info "Clearing the 'release' branch if it exists" -clear_release_breanch +clear_release_branch # Get user name if [[ -z "$BITBUCKET_STEP_TRIGGERER_UUID" ]]; then From 0bf21f2c2b5f8464e52cc50203ddc9f07fe1806e Mon Sep 17 00:00:00 2001 From: Alex Lourie Date: Tue, 9 Dec 2025 15:25:22 +1030 Subject: [PATCH 4/4] Wrap branch clearing Signed-off-by: Alex Lourie --- pipelines/scripts/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/scripts/common.sh b/pipelines/scripts/common.sh index 6f852a9..f26a9d9 100755 --- a/pipelines/scripts/common.sh +++ b/pipelines/scripts/common.sh @@ -185,7 +185,7 @@ tag_finalize_version() { clear_release_branch() { info "Clearing 'release' branch" - git ls-remote --exit-code --heads origin release >/dev/null 2>&1 + run git ls-remote --exit-code --heads origin release >/dev/null 2>&1 if [[ $? == '0' ]]; then run git push origin -d release fi