Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"mode": "pre",
"mode": "exit",
"tag": "next",
"initialVersions": {
"@reflag/browser-sdk": "2.0.0-next.0",
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Release packages

on:
workflow_dispatch:
push:
branches:
- main
Expand All @@ -9,6 +10,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
30 changes: 20 additions & 10 deletions scripts/release-channel.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ test("all stable-doc publication steps require a stable release channel", () =>
workflow,
/id: release-channel\s+run: node scripts\/release-channel\.mjs >> "\$GITHUB_OUTPUT"/,
);
assert.match(workflow, /workflow_dispatch:/);
assert.match(
workflow,
/release:\s+if: github\.event_name == 'push' && github\.ref == 'refs\/heads\/main'/,
);
const conditions = workflow
.split("\n")
.map((line) => line.trim())
.filter((line) => line.startsWith("if: "));
.filter((line) => line.startsWith(" if: "))
.map((line) => line.trim());
assert.equal(conditions.length, 7);
for (const condition of conditions) {
assert.ok(
Expand Down Expand Up @@ -94,22 +99,27 @@ test("the real Changesets release plan follows the selected channel", async () =
`Unexpected ${channel} version for ${release.name}`,
);
}
// The first version PR must cover the complete v2 SDK family, not Node only.
// After versioning, consumed changesets need not produce another release.
if (channel === "next" && state.changesets.length === 0) {
// Both the first prerelease and stable exit must cover the complete v2
// toolchain. After versioning, consumed changesets need not release again.
if (
(channel === "next" && state.changesets.length === 0) ||
state?.mode === "exit"
) {
for (const name of [
"@reflag/node-sdk",
"@reflag/browser-sdk",
"@reflag/react-sdk",
"@reflag/vue-sdk",
"@reflag/react-native-sdk",
"@reflag/cli",
]) {
assert.ok(
plan.releases.some(
(release) => release.name === name && release.type !== "none",
),
`Missing initial prerelease for ${name}`,
const release = plan.releases.find(
(item) => item.name === name && item.type !== "none",
);
assert.ok(release, `Missing ${channel} release for ${name}`);
if (state.mode === "exit") {
assert.equal(release.newVersion, "2.0.0");
}
}
}
});
Expand Down
Loading