From b1c580c6262533e26824533b1eb647db607c044d Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Wed, 10 Dec 2025 10:35:24 -0600 Subject: [PATCH] ci(workflow): Improve release tag detection and artifact changelog (#3954) --- .github/workflows/main-push-changelog.yml | 30 ++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main-push-changelog.yml b/.github/workflows/main-push-changelog.yml index 25de53475..37614d58f 100644 --- a/.github/workflows/main-push-changelog.yml +++ b/.github/workflows/main-push-changelog.yml @@ -22,8 +22,18 @@ jobs: - name: Determine last production tag id: last_prod_tag run: | - # Find the most recent tag that looks like a production release (vX.Y.Z) - TAG=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-creatordate | head -n 1) + # Find the highest semantic version tag of the form vX.Y.Z + # and ignore any tags with suffixes like -track.N, -rc.N, etc. + TAG=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' \ + | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \ + | sed 's/^v//' \ + | sort -V \ + | tail -n 1) + + if [ -n "$TAG" ]; then + TAG="v$TAG" + fi + echo "Found last production tag: $TAG" echo "tag=$TAG" >> "$GITHUB_OUTPUT" @@ -38,6 +48,21 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Save changelog to file + if: steps.last_prod_tag.outputs.tag != '' + run: | + mkdir -p artifacts + cat << 'EOF' > artifacts/main-push-changelog.md + ${{ steps.changelog.outputs.changelog }} + EOF + + - name: Upload changelog artifact + if: steps.last_prod_tag.outputs.tag != '' + uses: actions/upload-artifact@v4 + with: + name: main-push-changelog + path: artifacts/main-push-changelog.md + - name: Print main push summary run: | echo "Pushed to main" @@ -52,4 +77,3 @@ jobs: else echo "No production tag (vX.Y.Z) found. Skipping changelog generation." fi -