Skip to content

Commit b34ca68

Browse files
committed
chore(release): move macOS note to release body footer
1 parent 54cffb3 commit b34ca68

3 files changed

Lines changed: 23 additions & 17 deletions

File tree

docs/project/release-notes.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,15 @@ pnpm version:publish
110110

111111
- 英文区块
112112
- `Summary`
113-
- `macOS Security Note`
114113
- 安装文档链接
115114
- 英文全文链接
116115
- 中文区块
117116
- `概括`
118-
- `macOS 安全提示`
119117
- 安装文档链接
120118
- 中文全文链接
119+
- 末尾轻量 macOS 备注
121120

122-
其中 `macOS Security Note / macOS 安全提示` 为固定内容,用来明确说明:
123-
124-
- “已损坏”
125-
- “无法验证开发者”
126-
127-
这类提示通常来自 macOS 的隔离属性,不一定是应用本身损坏。
121+
末尾 macOS 备注可以完整说明隔离属性的现象和处理命令;因为它放在正文最后,不会压过发布摘要。
128122

129123
如果历史版本缺少概括,渲染逻辑可以回退为全文;但正式发布流程会被校验阻塞。
130124

scripts/release-notes.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,18 @@ function buildTagScopedFileUrl(repository, tag, relativePath) {
539539

540540
function renderMacSecurityNote(locale) {
541541
if (locale === 'en') {
542-
return '> macOS note: if the app is reported as damaged or unverified, remove quarantine with `xattr -rd com.apple.quarantine /Applications/PromptOptimizer.app` (or run it on `~/Downloads/PromptOptimizer-*.dmg` before installing).';
542+
return [
543+
'macOS note: if macOS reports the app as damaged or cannot verify the developer, this is usually caused by the quarantine attribute on downloaded apps. See the installation guide, or remove it after installing with `xattr -rd com.apple.quarantine /Applications/PromptOptimizer.app`; for a downloaded DMG, you can run the same command on `~/Downloads/PromptOptimizer-*.dmg` before installing.',
544+
].join('\n');
545+
}
546+
547+
if (locale === 'zh-CN') {
548+
return [
549+
'macOS 备注:如果 macOS 提示“已损坏”或“无法验证开发者”,通常是下载文件的隔离属性导致。请参考安装文档;也可以在安装后执行 `xattr -rd com.apple.quarantine /Applications/PromptOptimizer.app`,或在安装前对 `~/Downloads/PromptOptimizer-*.dmg` 执行同类命令。',
550+
].join('\n');
543551
}
544552

545-
return '> macOS 提示:如果提示“已损坏”或“无法验证开发者”,可用 `xattr -rd com.apple.quarantine /Applications/PromptOptimizer.app` 移除隔离属性;DMG 可先对 `~/Downloads/PromptOptimizer-*.dmg` 执行。';
553+
return [renderMacSecurityNote('en'), renderMacSecurityNote('zh-CN')].join('\n');
546554
}
547555

548556
function renderGitHubReleaseBody({ cwd = process.cwd(), version, repository }) {
@@ -565,8 +573,6 @@ function renderGitHubReleaseBody({ cwd = process.cwd(), version, repository }) {
565573
'### Summary',
566574
englishSummary,
567575
'',
568-
renderMacSecurityNote('en'),
569-
'',
570576
`Installation guide: [English](${englishGuideUrl}) | [中文](${chineseGuideUrl})`,
571577
`[Full release notes (EN)](${buildTagScopedFileUrl(repository, tag, getReleaseNotesRelativePath(normalizedVersion, 'en', cwd))})`,
572578
'',
@@ -577,11 +583,13 @@ function renderGitHubReleaseBody({ cwd = process.cwd(), version, repository }) {
577583
'### 概括',
578584
chineseSummary,
579585
'',
580-
renderMacSecurityNote('zh-CN'),
581-
'',
582586
`安装文档:[English](${englishGuideUrl}) | [中文](${chineseGuideUrl})`,
583587
`[完整发布说明(中文)](${buildTagScopedFileUrl(repository, tag, getReleaseNotesRelativePath(normalizedVersion, 'zh-CN', cwd))})`,
584588
'',
589+
'---',
590+
'',
591+
renderMacSecurityNote(),
592+
'',
585593
].join('\n');
586594
}
587595

scripts/release-notes.test.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ test('validateReleaseArtifacts can validate a matching non-top changelog entry f
348348
assert.deepEqual(historicalResult.errors, []);
349349
});
350350

351-
test('renderGitHubReleaseBody renders English first, then Chinese, with macOS note and guide links', () => {
351+
test('renderGitHubReleaseBody renders English first, then Chinese, with final macOS note and guide links', () => {
352352
const root = createTempRepo();
353353
writeFile(root, 'releases/v2.8.0.en.md', buildValidEnglishReleaseNotes('2.8.0'));
354354
writeFile(root, 'releases/v2.8.0.zh-CN.md', buildValidChineseReleaseNotes('2.8.0'));
@@ -361,15 +361,19 @@ test('renderGitHubReleaseBody renders English first, then Chinese, with macOS no
361361

362362
assert.match(body, /^## English$/m);
363363
assert.match(body, /^### Summary$/m);
364-
assert.match(body, /^### macOS Security Note$/m);
365364
assert.match(body, /^Installation guide: \[English\]\(https:\/\/github\.com\/linshenkx\/prompt-optimizer\/blob\/v2\.8\.0\/mkdocs\/docs\/en\/deployment\/desktop\.md\) \| \[\]\(https:\/\/github\.com\/linshenkx\/prompt-optimizer\/blob\/v2\.8\.0\/mkdocs\/docs\/zh\/deployment\/desktop\.md\)$/m);
366365
assert.match(body, /\[Full release notes \(EN\)\]\(https:\/\/github\.com\/linshenkx\/prompt-optimizer\/blob\/v2\.8\.0\/releases\/v2\.8\.0\.en\.md\)/);
367366
assert.match(body, /^---$/m);
368367
assert.match(body, /^## $/m);
369368
assert.match(body, /^### $/m);
370-
assert.match(body, /^### macOS $/m);
371369
assert.match(body, /^\[English\]\(https:\/\/github\.com\/linshenkx\/prompt-optimizer\/blob\/v2\.8\.0\/mkdocs\/docs\/en\/deployment\/desktop\.md\) \| \[\]\(https:\/\/github\.com\/linshenkx\/prompt-optimizer\/blob\/v2\.8\.0\/mkdocs\/docs\/zh\/deployment\/desktop\.md\)$/m);
372370
assert.match(body, /\[\]\(https:\/\/github\.com\/linshenkx\/prompt-optimizer\/blob\/v2\.8\.0\/releases\/v2\.8\.0\.zh-CN\.md\)/);
371+
assert.doesNotMatch(body, /^### macOS/m);
372+
assert.match(body, /^macOS note: if macOS reports the app as damaged or cannot verify the developer, this is usually caused by the quarantine attribute on downloaded apps\./m);
373+
assert.match(body, /^macOS macOS /m);
374+
assert.match(body, /xattr -rd com\.apple\.quarantine \/Applications\/PromptOptimizer\.app/);
375+
assert.match(body, /~\/Downloads\/PromptOptimizer-\*\.dmg/);
376+
assert.ok(body.lastIndexOf('macOS note:') > body.indexOf('[完整发布说明(中文)]'));
373377
});
374378

375379
test('renderGitHubReleaseBody falls back to full text when summaries are absent', () => {

0 commit comments

Comments
 (0)