Skip to content

Commit fdc8b26

Browse files
committed
release: prepare SDK v2 for npm latest
1 parent 0a5d994 commit fdc8b26

3 files changed

Lines changed: 23 additions & 11 deletions

File tree

‎.changeset/pre.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"mode": "pre",
2+
"mode": "exit",
33
"tag": "next",
44
"initialVersions": {
55
"@reflag/browser-sdk": "2.0.0-next.0",

‎.github/workflows/publish.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Release packages
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
@@ -9,6 +10,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
910

1011
jobs:
1112
release:
13+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
1214
runs-on: ubuntu-latest
1315
permissions:
1416
contents: write

‎scripts/release-channel.test.mjs‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,15 @@ test("all stable-doc publication steps require a stable release channel", () =>
5959
workflow,
6060
/id: release-channel\s+run: node scripts\/release-channel\.mjs >> "\$GITHUB_OUTPUT"/,
6161
);
62+
assert.match(workflow, /workflow_dispatch:/);
63+
assert.match(
64+
workflow,
65+
/release:\s+if: github\.event_name == 'push' && github\.ref == 'refs\/heads\/main'/,
66+
);
6267
const conditions = workflow
6368
.split("\n")
64-
.map((line) => line.trim())
65-
.filter((line) => line.startsWith("if: "));
69+
.filter((line) => line.startsWith(" if: "))
70+
.map((line) => line.trim());
6671
assert.equal(conditions.length, 7);
6772
for (const condition of conditions) {
6873
assert.ok(
@@ -94,22 +99,27 @@ test("the real Changesets release plan follows the selected channel", async () =
9499
`Unexpected ${channel} version for ${release.name}`,
95100
);
96101
}
97-
// The first version PR must cover the complete v2 SDK family, not Node only.
98-
// After versioning, consumed changesets need not produce another release.
99-
if (channel === "next" && state.changesets.length === 0) {
102+
// Both the first prerelease and stable exit must cover the complete v2
103+
// toolchain. After versioning, consumed changesets need not release again.
104+
if (
105+
(channel === "next" && state.changesets.length === 0) ||
106+
state?.mode === "exit"
107+
) {
100108
for (const name of [
101109
"@reflag/node-sdk",
102110
"@reflag/browser-sdk",
103111
"@reflag/react-sdk",
104112
"@reflag/vue-sdk",
105113
"@reflag/react-native-sdk",
114+
"@reflag/cli",
106115
]) {
107-
assert.ok(
108-
plan.releases.some(
109-
(release) => release.name === name && release.type !== "none",
110-
),
111-
`Missing initial prerelease for ${name}`,
116+
const release = plan.releases.find(
117+
(item) => item.name === name && item.type !== "none",
112118
);
119+
assert.ok(release, `Missing ${channel} release for ${name}`);
120+
if (state.mode === "exit") {
121+
assert.equal(release.newVersion, "2.0.0");
122+
}
113123
}
114124
}
115125
});

0 commit comments

Comments
 (0)