Skip to content

Commit 406cb7a

Browse files
PerishCodeSiri-Ray
authored andcommitted
fix(release): align stable notes public origin (nexu-io#5037)
Co-authored-by: Siri-Ray <2667192167@qq.com>
1 parent be33d22 commit 406cb7a

3 files changed

Lines changed: 50 additions & 2 deletions

File tree

.github/scripts/release/github/stable-notes.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
for name in BRANCH_NAME CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN GITHUB_OUTPUT GITHUB_REPOSITORY GITHUB_SHA RELEASE_CHANNEL RELEASE_SIGNED RELEASE_VERSION RUNNER_TEMP VERSION_TAG; do
4+
for name in BRANCH_NAME GITHUB_OUTPUT GITHUB_REPOSITORY GITHUB_SHA RELEASE_CHANNEL RELEASE_SIGNED RELEASE_VERSION RUNNER_TEMP VERSION_TAG; do
55
if [ -z "${!name:-}" ]; then
66
echo "$name is required" >&2
77
exit 1
88
fi
99
done
1010

11+
release_public_origin="${RELEASE_PUBLIC_ORIGIN:-${CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN:-}}"
12+
if [ -z "$release_public_origin" ]; then
13+
echo "RELEASE_PUBLIC_ORIGIN or CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN is required" >&2
14+
exit 1
15+
fi
16+
1117
notes_file="$RUNNER_TEMP/open-design-stable-notes.md"
12-
public_origin="${CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN%/}"
18+
public_origin="${release_public_origin%/}"
1319
cat > "$notes_file" <<EOF
1420
## Summary
1521
- channel: $RELEASE_CHANNEL

.github/workflows/release-stable.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,8 @@ jobs:
12611261
- name: Write stable release notes
12621262
id: notes
12631263
if: ${{ needs.metadata.outputs.github_release_enabled == 'true' }}
1264+
env:
1265+
RELEASE_PUBLIC_ORIGIN: ${{ vars.CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN }}
12641266
run: bash .github/scripts/release/github/stable-notes.sh
12651267

12661268
- name: Create draft release with tag

e2e/tests/packaged-smoke-workflow.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const releaseBetaSelfHostedWorkflowPath = join(workspaceRoot, ".github", "workfl
3636
const releasePreviewWorkflowPath = join(workspaceRoot, ".github", "workflows", "release-preview.yml");
3737
const releasePrereleaseWorkflowPath = join(workspaceRoot, ".github", "workflows", "release-prerelease.yml");
3838
const releaseStableWorkflowPath = join(workspaceRoot, ".github", "workflows", "release-stable.yml");
39+
const releaseStableNotesScriptPath = join(workspaceRoot, ".github", "scripts", "release", "github", "stable-notes.sh");
3940
const releasePreviewScriptPath = join(workspaceRoot, "tools", "release", "src", "metadata", "prepare-preview.ts");
4041
const releaseStableScriptPath = join(workspaceRoot, "tools", "release", "src", "metadata", "prepare-stable.ts");
4142
const releaseBetaScriptPath = join(workspaceRoot, "tools", "release", "src", "metadata", "prepare-beta.ts");
@@ -1407,6 +1408,8 @@ process.stdin.on("end", () => {
14071408
expect(workflow).toContain("default: metadata");
14081409
expect(workflow).not.toContain("inputs.channel");
14091410
expect(workflow).toContain("OPEN_DESIGN_RELEASE_DRY_RUN: ${{ inputs.dry_run == 'publish' && 'false' || inputs.dry_run }}");
1411+
expect(workflow).toContain("RELEASE_PUBLIC_ORIGIN: ${{ vars.CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN }}");
1412+
expect(workflow).toContain("run: bash .github/scripts/release/github/stable-notes.sh");
14101413
expect(workflow).toContain("dry_run: ${{ steps.stable.outputs.dry_run }}");
14111414
expect(workflow).toContain("dry_run_mode: ${{ steps.stable.outputs.dry_run_mode }}");
14121415
expect(workflow).toContain("if: ${{ needs.metadata.outputs.run_prepublish_jobs == 'true' }}");
@@ -1420,6 +1423,43 @@ process.stdin.on("end", () => {
14201423
expect(script).toContain('setOutput("publish_side_effects_enabled", publishSideEffectsEnabled ? "true" : "false");');
14211424
});
14221425

1426+
it("[P2] writes stable release notes from the release public origin variable", async () => {
1427+
for (const [envName, origin] of [
1428+
["RELEASE_PUBLIC_ORIGIN", "https://releases.open-design.ai/current/"],
1429+
["CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN", "https://releases.open-design.ai/legacy/"],
1430+
] as const) {
1431+
const runnerTemp = await mkdtemp(join(tmpdir(), "od-stable-notes-"));
1432+
const outputPath = join(runnerTemp, "github-output.txt");
1433+
1434+
try {
1435+
await execFileAsync("bash", [releaseStableNotesScriptPath], {
1436+
cwd: workspaceRoot,
1437+
env: {
1438+
...process.env,
1439+
BRANCH_NAME: "release/v0.13.0",
1440+
CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN: envName === "CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN" ? origin : "",
1441+
GITHUB_OUTPUT: outputPath,
1442+
GITHUB_REPOSITORY: "nexu-io/open-design",
1443+
GITHUB_SHA: "0123456789abcdef0123456789abcdef01234567",
1444+
RELEASE_CHANNEL: "stable",
1445+
RELEASE_PUBLIC_ORIGIN: envName === "RELEASE_PUBLIC_ORIGIN" ? origin : "",
1446+
RELEASE_SIGNED: "true",
1447+
RELEASE_VERSION: "0.13.0",
1448+
RUNNER_TEMP: runnerTemp,
1449+
VERSION_TAG: "open-design-v0.13.0",
1450+
},
1451+
});
1452+
1453+
const outputs = parseGithubOutput(await readFile(outputPath, "utf8"));
1454+
const notes = await readFile(outputs.notes_file ?? "", "utf8");
1455+
expect(notes).toContain(`R2 metadata: ${origin.replace(/\/+$/, "")}/stable/latest/metadata.json`);
1456+
expect(notes).toContain(`E2E report: ${origin.replace(/\/+$/, "")}/stable/versions/0.13.0/report.zip`);
1457+
} finally {
1458+
await rm(runnerTemp, { force: true, recursive: true });
1459+
}
1460+
}
1461+
});
1462+
14231463
it("[P2] validates stable dry-run prerelease metadata from a release branch", async () => {
14241464
const baseVersion = await readPackagedVersion();
14251465
const prereleaseVersion = `${baseVersion}-prerelease.12`;

0 commit comments

Comments
 (0)