Skip to content

Commit c84fb6d

Browse files
authored
fix(ci): sync-upstream prefers stable releases over prereleases (#70)
* fix(ci): sync-upstream prefers stable releases over prereleases Consistency with the frontend fix: select the newest STABLE release (no -alpha/-beta/-rc suffix), falling back to the newest non-alpha prerelease only when no stable exists. The backend currently only has stable tags so behavior is unchanged (still v11.0.3), but this hardens the selection against any future prerelease tags upstream might publish. * harden: abort sync if no upstream tag matched (empty TAG guard)
1 parent ab47c73 commit c84fb6d

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/sync-upstream.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,20 @@ jobs:
3939
if [ -n "${{ inputs.tag }}" ]; then
4040
TAG="${{ inputs.tag }}"
4141
else
42-
# Get latest release tag from upstream (filter only vX.Y.Z pattern)
43-
TAG=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | head -1)
42+
# Prefer the newest STABLE release (no -alpha/-beta/-rc suffix).
43+
# Fall back to the newest non-alpha prerelease (beta/rc) only when no
44+
# stable release exists. Never auto-sync -alpha tags.
45+
TAG=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | grep -vE -- '-' | head -1)
46+
if [ -z "$TAG" ]; then
47+
TAG=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | grep -ivE -- '-alpha' | head -1)
48+
fi
4449
fi
50+
51+
if [ -z "$TAG" ]; then
52+
echo "::error::No upstream release tag matched 'v[0-9]*.[0-9]*.[0-9]*'. Aborting."
53+
exit 1
54+
fi
55+
4556
echo "tag=$TAG" >> $GITHUB_OUTPUT
4657
echo "Target tag: $TAG"
4758

0 commit comments

Comments
 (0)