From ed1faa1d315fe7e01ea91731cc7ad24f1a4073ac Mon Sep 17 00:00:00 2001 From: Russell Bunch Date: Thu, 7 Nov 2024 11:02:56 -0600 Subject: [PATCH] Mark stable tags from default branch as latest Do not mark stable tags from release or maintenance branches as latest. --- .github/workflows/promote-release.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/promote-release.yml b/.github/workflows/promote-release.yml index 93899354..e4fffdb7 100644 --- a/.github/workflows/promote-release.yml +++ b/.github/workflows/promote-release.yml @@ -7,6 +7,7 @@ on: workflow_dispatch: env: STREAM: stable + LATEST: false jobs: Promote: runs-on: ubuntu-latest @@ -24,13 +25,26 @@ jobs: with: STREAM: ${{ env.STREAM }} + - name: Get Branch + run: | + mapfile -t branches < <(git branch -r --contains ${{ github.ref }} | awk '{print $1}') + echo "${branches[@]}" + for branch in "${branches[@]}"; do + branch_name="${branch/origin\/}" + echo "${branch_name}" + if [ "${branch_name}" = 'main' ]; then + echo LATEST=true >> $GITHUB_ENV + break + fi + done + - uses: ncipollo/release-action@v1 with: allowUpdates: true # if the job is re-ran to catch missed artifacts, allow updates generateReleaseNotes: true artifacts: ${{ env.DIR_UPLOAD }}/* prerelease: false - makeLatest: true + makeLatest: ${{ fromJSON(env.LATEST) }} generate_publish_docs: name: generate docs with nox/sphinx and publish with mike