Skip to content

Commit 133f208

Browse files
Temporarily use beta versions for "latest" dist-tag (#1283)
1 parent efc7aa7 commit 133f208

3 files changed

Lines changed: 19 additions & 27 deletions

File tree

.github/workflows/publish.yml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,10 @@ jobs:
5959
if [ -n "${{ github.event.inputs.version }}" ]; then
6060
VERSION="${{ github.event.inputs.version }}"
6161
# Validate version format matches dist-tag
62-
if [ "${{ github.event.inputs.dist-tag }}" = "latest" ]; then
63-
if [[ "$VERSION" == *-* ]]; then
64-
echo "❌ Error: Version '$VERSION' has a prerelease suffix but dist-tag is 'latest'" >> $GITHUB_STEP_SUMMARY
65-
echo "Use a version without suffix (e.g., '1.0.0') for latest releases"
66-
exit 1
67-
fi
68-
else
62+
# TEMPORARY: skips validation for "latest" so prerelease versions
63+
# can be published under that tag. To ship stable 1.0.0, revert the
64+
# commit that introduced this temporary change.
65+
if [ "${{ github.event.inputs.dist-tag }}" != "latest" ]; then
6966
if [[ "$VERSION" != *-* ]]; then
7067
echo "❌ Error: Version '$VERSION' has no prerelease suffix but dist-tag is '${{ github.event.inputs.dist-tag }}'" >> $GITHUB_STEP_SUMMARY
7168
echo "Use a version with suffix (e.g., '1.0.0-preview.0') for prerelease/unstable"
@@ -222,21 +219,11 @@ jobs:
222219
runs-on: ubuntu-latest
223220
steps:
224221
- uses: actions/checkout@v6.0.2
222+
# TEMPORARY: both "latest" and "prerelease" create GitHub pre-releases
223+
# since "latest" publishes beta versions. To ship stable 1.0.0, revert
224+
# the commit that introduced this temporary change.
225225
- name: Create GitHub Release
226-
if: github.event.inputs.dist-tag == 'latest'
227-
run: |
228-
NOTES_FLAG=""
229-
if git rev-parse "v${{ needs.version.outputs.current }}" >/dev/null 2>&1; then
230-
NOTES_FLAG="--notes-start-tag v${{ needs.version.outputs.current }}"
231-
fi
232-
gh release create "v${{ needs.version.outputs.version }}" \
233-
--title "v${{ needs.version.outputs.version }}" \
234-
--generate-notes $NOTES_FLAG \
235-
--target ${{ github.sha }}
236-
env:
237-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
238-
- name: Create GitHub Pre-Release
239-
if: github.event.inputs.dist-tag == 'prerelease'
226+
if: github.event.inputs.dist-tag == 'latest' || github.event.inputs.dist-tag == 'prerelease'
240227
run: |
241228
NOTES_FLAG=""
242229
if git rev-parse "v${{ needs.version.outputs.current-prerelease }}" >/dev/null 2>&1; then

nodejs/scripts/calculate-version.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ export function calculateVersion(command, { latest, prerelease, unstable }) {
4343
}
4444
}
4545

46-
const increment = command === "latest" ? "patch" : "prerelease";
46+
// TEMPORARY: "latest" uses prerelease increments so we publish beta versions
47+
// under the "latest" dist-tag. To ship stable 1.0.0, revert the commit that
48+
// introduced this temporary change.
49+
const increment = "prerelease";
4750
const isIncrementingExistingPrerelease = semver.prerelease(higherVersion) !== null;
4851
const prereleaseIdentifier =
49-
command === "prerelease"
52+
command === "prerelease" || command === "latest"
5053
? isIncrementingExistingPrerelease
5154
? undefined
5255
: "preview"

nodejs/test/get-version.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { describe, expect, it } from "vitest";
22
import { calculateVersion } from "../scripts/calculate-version.js";
33

44
describe("get-version", () => {
5-
it("increments stable latest versions by patch", () => {
6-
expect(calculateVersion("latest", { latest: "1.0.1" })).toBe("1.0.2");
5+
// TEMPORARY: these two tests reflect beta-as-latest behavior. To ship
6+
// stable 1.0.0, revert the commit that introduced this temporary change.
7+
it("increments latest versions as prerelease (temporary beta behavior)", () => {
8+
expect(calculateVersion("latest", { latest: "1.0.1" })).toBe("1.0.2-preview.0");
79
});
810

9-
it("promotes a higher prerelease to stable for latest releases", () => {
11+
it("continues beta prerelease for latest releases (temporary beta behavior)", () => {
1012
expect(calculateVersion("latest", { latest: "0.3.0", prerelease: "1.0.0-beta.1" })).toBe(
11-
"1.0.0"
13+
"1.0.0-beta.2"
1214
);
1315
});
1416

0 commit comments

Comments
 (0)