chore: ignore pre-release tags for version docs build (#11900)

# Which Problems Are Solved

For switching v4.x releases to a corresponding maintenance branch, we
had to trick semantic release and create a `5.0.0-base` tag on main.
This now breaks the docs build, which tries to fetch all tags and build
a corresponding version.

# How the Problems Are Solved

- Ignore pre-released tags/releases for the moment.

# Additional Changes

None

# Additional Context

- requires backport to v4.x
This commit is contained in:
Livio Spring
2026-03-23 14:15:23 +01:00
committed by GitHub
parent c6386cb807
commit 85ce8c153b
3 changed files with 24 additions and 8 deletions
+4 -1
View File
@@ -108,7 +108,10 @@ export function filterVersions(tags) {
const valid = semver.valid(v);
if (!valid) return false;
// Strict cutoff: Do not fetch or build anything older (including that version)
return semver.gt(v, CUTOFF);
const isAboveCutoff = semver.gt(v, CUTOFF);
if (!isAboveCutoff) return false;
return semver.prerelease(v) === null;
})
.sort((a, b) => semver.rcompare(a, b));
@@ -128,22 +128,34 @@ describe('fetch-remote-content', () => {
const { filterVersions } = await import('./fetch-remote-content.mjs');
const tags = [
{ name: 'v4.9.0' },
{ name: 'v4.10.0' }, // Matches cutoff strictly > 4.10.0? No, gt is strict.
{ name: 'v4.10.0' }, // Equal to cutoff — excluded (gt is strict)
{ name: 'v4.11.0' },
{ name: 'v5.0.0-alpha' },
{ name: 'invalid' }
];
const result = filterVersions(tags);
// Expect only v4.11.0 and v5.0.0-alpha, but slice(0, 3) logic applies
// If gt(4.10.0), then 4.10.0 is excluded.
// sort is rcompare (descending).
// 5.0.0-alpha, 4.11.0
assert.ok(result.includes('v4.11.0'));
assert.ok(!result.includes('v4.10.0'));
assert.ok(!result.includes('v4.9.0'));
});
test('excludes prerelease tags', async () => {
const { filterVersions } = await import('./fetch-remote-content.mjs');
const tags = [
{ name: 'v5.0.0' },
{ name: 'v5.0.0-alpha' },
{ name: 'v5.0.0-beta.1' },
{ name: 'v4.11.0-rc.1' },
{ name: 'v4.11.0' },
];
const result = filterVersions(tags);
assert.ok(result.includes('v5.0.0'), 'stable release should be included');
assert.ok(result.includes('v4.11.0'), 'stable release should be included');
assert.ok(!result.includes('v5.0.0-alpha'), 'alpha prerelease should be excluded');
assert.ok(!result.includes('v5.0.0-beta.1'), 'beta prerelease should be excluded');
assert.ok(!result.includes('v4.11.0-rc.1'), 'rc prerelease should be excluded');
});
});
});