diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6fd0d7f3e..9b54d3c86 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,14 +9,14 @@ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa26745bb..2de434824 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -180,8 +180,8 @@ reserve `spike/` for experiments. No issue number is required. 中文说明:PR A pull request should explain the problem, the chosen design, verification performed, user-visible or operational effects, and remaining risks. Before a product-changing integration PR is accepted, fill its exact `## Release notes` section -with concise public copy in Chinese and English: user-visible changes, fixes and -required upgrade actions. Use `###` for subsections. Review this text as product +with concise public copy in English followed by Chinese: user-visible changes, +fixes and required upgrade actions. Use `###` for subsections. Review this text as product copy; it is published automatically from the squash commit, without PR discussion or verification logs. The [release-note policy](./docs/standards/versioning.md#release-notes) owns the optional editorial headline, aggregation and preview. Review the diff --git a/docs/standards/versioning.md b/docs/standards/versioning.md index 5d2163829..b8c858263 100644 --- a/docs/standards/versioning.md +++ b/docs/standards/versioning.md @@ -240,7 +240,7 @@ apply. Preserve the original image and packages for retries. ## Release Notes GitHub Releases owns the published changelog. Each product-changing PR supplies reviewed -Chinese and English user-facing copy under the exact `## Release notes` heading +English and Chinese user-facing copy under the exact `## Release notes` heading in its squash commit; `###` headings structure that copy. Explain benefits, fixes and required upgrade actions, including breaking changes. Keep internal work logs, audit handoffs and unverified claims outside this public section. @@ -278,8 +278,8 @@ thanks or an occasional light aside can lead. Keep Piik's friendly tone without forced jokes; never turn an old feature into a claim that it is new in this update, advertise an unfinished prototype or trivialize a serious failure. -When used, write the headline as the first two bold paragraphs, Chinese then -English, with plain text inside `**...**`. The website reads this same pair from +When used, write the headline as the first two bold paragraphs, English then +Chinese, with plain text inside `**...**`. The website reads this same pair from the published Release body and displays the current language; it does not keep another copy, interpret arbitrary Markdown or guess a headline from older releases. Gitee retains the same body. Do not add a campaign registry or automatic @@ -295,8 +295,9 @@ Then group concrete changes under useful headings such as highlights, fixes, upgrade instructions or known limitations. Omit empty categories and routine implementation/test inventories. A small fix may need only its introduction and a few bullets. Required upgrade steps or interruptions must be easy to find. -Chinese and English cover the same release facts with natural phrasing. Use -`###` for language sections and `####` for categories when both are needed. +English and Chinese cover the same release facts with natural phrasing, with +English first. Use `###` for language sections and `####` for categories when +both are needed. The approved final description must read as one release when several unpublished commits are included. Preview the rendered aggregate with at most one bilingual diff --git a/scripts/release-headline.mjs b/scripts/release-headline.mjs index 38724d885..83a20944b 100644 --- a/scripts/release-headline.mjs +++ b/scripts/release-headline.mjs @@ -1,11 +1,11 @@ -// The release editor owns two leading bold paragraphs: Chinese, then English. +// The release editor owns two leading bold paragraphs: English, then Chinese. // Read only that pair; older release prose is not an inferred headline. export function splitReleaseHeadline(body) { if (typeof body !== "string") return { headline: null, notes: "" }; const opening = /^\s*\*\*([^*\r\n]+)\*\*[ \t]*\r?\n(?:[ \t]*\r?\n)+\*\*([^*\r\n]+)\*\*(?:[ \t]*\r?\n(?:[ \t]*\r?\n)+|[ \t]*$)/.exec(body); if (!opening || !opening[1].trim() || !opening[2].trim()) return { headline: null, notes: body }; return { - headline: { "zh-CN": opening[1].trim(), en: opening[2].trim() }, + headline: { en: opening[1].trim(), "zh-CN": opening[2].trim() }, notes: body.slice(opening[0].length).trimStart(), }; } diff --git a/scripts/release-notes.mjs b/scripts/release-notes.mjs index 7741e4cee..dbda6cc03 100644 --- a/scripts/release-notes.mjs +++ b/scripts/release-notes.mjs @@ -53,7 +53,7 @@ export function releaseNotes(root, version, revision, repository, { allowEmpty = const source = previous ? `[完整变更 / Full changelog](${url}/compare/${previous}...${revision})` : `[源代码 / Source](${url}/tree/${revision})`; - const opening = headline ? `**${headline["zh-CN"]}**\n\n**${headline.en}**\n\n` : ""; + const opening = headline ? `**${headline.en}**\n\n**${headline["zh-CN"]}**\n\n` : ""; return `${opening}${bodies.join("\n\n")}\n\n---\n\n${source}\n`; } diff --git a/tests/release-automation.test.ts b/tests/release-automation.test.ts index e64476fdc..214a56eee 100644 --- a/tests/release-automation.test.ts +++ b/tests/release-automation.test.ts @@ -14,7 +14,7 @@ const sha = (value: string) => createHash("sha256").update(value).digest("hex"); describe("release automation", () => { it("shares only an authored leading bilingual headline with the website", () => { - const opening = "**远程同乐,轮到你啦!**\n\n**Play together. Your turn!**"; + const opening = "**Play together. Your turn!**\n\n**远程同乐,轮到你啦!**"; expect(splitReleaseHeadline(`${opening}\n\n### 中文\n\n修复开播。`)).toEqual({ headline: { "zh-CN": "远程同乐,轮到你啦!", en: "Play together. Your turn!" }, notes: "### 中文\n\n修复开播。", @@ -102,8 +102,8 @@ describe("release automation", () => { cwd: root, encoding: "utf8", env: { ...process.env, PIIK_BUILD_VERSION: "v1.0.1" }, })); expect(candidate).toMatchObject({ version: "v1.0.1", publish: false }); - commit("fix: repair playback\n\n## Release notes\n**旧主题**\n\n**Earlier theme**\n\n- Playback resumes after reconnecting."); - const opening = "**远程同乐,轮到你啦!**\n\n**Play together. Your turn!**"; + commit("fix: repair playback\n\n## Release notes\n**Earlier theme**\n\n**旧主题**\n\n- Playback resumes after reconnecting."); + const opening = "**Play together. Your turn!**\n\n**远程同乐,轮到你啦!**"; const next = commit(`feat: add a sharing option\n\n## Release notes\n${opening}\n\n- Choose a window to share.`); const notes = releaseNotes(root, "v1.1.0", next, "fixture/Piik"); expect(notes.startsWith(opening)).toBe(true);