From e2c830d861b5856229e252ba14e01af2b1f18b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E5=BE=B7=E6=A3=AE?= Date: Wed, 21 Oct 2026 22:19:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E8=A7=A6=E5=8F=91=E5=AE=98=E7=BD=91?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=B7=A5=E4=BD=9C=E6=B5=81=E5=85=A5=E5=8F=A3?= =?UTF-8?q?=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sync-website.yml | 13 ++++++++++++- ...\217\221\345\270\203\346\265\201\347\250\213.md" | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-website.yml b/.github/workflows/sync-website.yml index 9b5a899..96f2683 100644 --- a/.github/workflows/sync-website.yml +++ b/.github/workflows/sync-website.yml @@ -1,6 +1,9 @@ name: 同步官网桌面版本与更新记录 on: + push: + branches: [main] + paths: [.github/workflows/sync-website.yml] workflow_dispatch: inputs: tag: @@ -14,10 +17,18 @@ permissions: contents: read concurrency: - group: sync-website-${{ github.event.release.tag_name || inputs.tag }} + group: sync-website-${{ github.event.release.tag_name || inputs.tag || github.ref }} cancel-in-progress: false jobs: + check: + name: 检查官网同步入口 + if: github.event_name == 'push' + runs-on: ubuntu-24.04 + timeout-minutes: 1 + steps: + - run: echo '工作流配置已加载,可从 Run workflow 指定正式桌面 Release 标签。' + sync: name: 提交官网桌面版本与更新记录 if: github.event_name == 'workflow_dispatch' || (startsWith(github.event.release.tag_name, 'desktop-v') && !github.event.release.draft && !github.event.release.prerelease) diff --git "a/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" "b/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" index 06d2222..1f4a2c2 100644 --- "a/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" +++ "b/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" @@ -10,6 +10,8 @@ 正式桌面 Release 发布或编辑后,`.github/workflows/sync-website.yml` 仅按事件中的 Release ID 读取该版本的当前内容,创建或更新官网 `src/content/releases/<版本号>.md`,不遍历历史 Release 或官网文件树,也不自动补齐历史记录。Markdown frontmatter 保存版本、发布日期与来源链接,正文保留 Release 原文;无正文时显示未填写说明。仅当该版本高于官网 `desktopVersion` 时才更新下载版本;编辑旧版说明只更新该版本文件,不会降级下载入口。当前或更新版本缺少任一平台安装包时失败,旧版说明同步不检查安装包。版本变量与当前发布文件的变化通过 Git Trees API 在同一个 commit 中提交到 `joinTARP/web-site` 的 `main` 分支,内容相同则不提交,不修改其他版本文件或列表页 Markdown。草稿、预发布、CLI 发布不触发同步。官网托管平台需已连接该仓库,并启用 `main` 分支 push 自动构建。 +同步工作流文件推送到 `main` 时,仅执行不读取 Secret 的入口检查,以便 GitHub Actions 注册并显示工作流;普通源码 push 不触发它,也不会因此同步官网。 + 已发布版本不需要删除 Release 或移动标签。先合入官网改动,再将同步工作流合入桌面仓库默认分支并配置下述 Secret,随后打开桌面仓库 **Actions → 同步官网桌面版本与更新记录 → Run workflow**,选择默认分支,在 `tag` 填写真实发布标签(如 `desktop-v0.1.1`)后运行。手动入口只读取指定 Release,仍会拒绝草稿、预发布和不符合格式的标签;重复运行不会重复提交。旧标签对应的提交若尚未包含本工作流,编辑该 Release 不会触发新增工作流,使用手动入口补同步即可。不要为启用官网同步覆盖既有发布标签或重新打包。 首次使用需在桌面仓库 Actions Secrets 配置 `WEBSITE_CONTENTS_TOKEN`:使用 fine-grained PAT,仅选择 `joinTARP/web-site`,授予 **Contents: Read and write**,并确保组织已批准该 Token(如需审批)。Token 所属账号需有官网仓库写权限,且 `main` 分支规则允许该账号直接提交。默认 `GITHUB_TOKEN` 仅限当前仓库,不能用于此跨仓库提交。工作流文件须先合入桌面仓库默认分支,官网的 `desktopVersion`、带版本号的链接模板与发布内容集合、列表及详情页也须先提交到 `main`。同一 Release 的任务串行执行,不同 Release 使用独立并发组,避免互相取消排队任务。同步使用官网当前提交作为父提交和基础文件树,非强制更新分支;并发修改导致更新失败时不会覆盖他人提交,可重跑失败任务。同步提交的作者为 Token 所属账号;Token 缺失、过期或写入被分支规则拒绝时,工作流失败,不宣称官网已更新。 From 64f6ee6e1e6d76eb711967936054209faa7b6ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E5=BE=B7=E6=A3=AE?= Date: Wed, 21 Oct 2026 22:22:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?revert:=20=E7=A7=BB=E9=99=A4=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E5=B7=A5=E4=BD=9C=E6=B5=81=E5=85=A5=E5=8F=A3=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E4=B8=8E=E6=8E=92=E6=9F=A5=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sync-website.yml | 13 +------------ ...\217\221\345\270\203\346\265\201\347\250\213.md" | 2 -- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/sync-website.yml b/.github/workflows/sync-website.yml index 96f2683..9b5a899 100644 --- a/.github/workflows/sync-website.yml +++ b/.github/workflows/sync-website.yml @@ -1,9 +1,6 @@ name: 同步官网桌面版本与更新记录 on: - push: - branches: [main] - paths: [.github/workflows/sync-website.yml] workflow_dispatch: inputs: tag: @@ -17,18 +14,10 @@ permissions: contents: read concurrency: - group: sync-website-${{ github.event.release.tag_name || inputs.tag || github.ref }} + group: sync-website-${{ github.event.release.tag_name || inputs.tag }} cancel-in-progress: false jobs: - check: - name: 检查官网同步入口 - if: github.event_name == 'push' - runs-on: ubuntu-24.04 - timeout-minutes: 1 - steps: - - run: echo '工作流配置已加载,可从 Run workflow 指定正式桌面 Release 标签。' - sync: name: 提交官网桌面版本与更新记录 if: github.event_name == 'workflow_dispatch' || (startsWith(github.event.release.tag_name, 'desktop-v') && !github.event.release.draft && !github.event.release.prerelease) diff --git "a/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" "b/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" index 1f4a2c2..06d2222 100644 --- "a/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" +++ "b/docs/\345\217\221\345\270\203\346\265\201\347\250\213.md" @@ -10,8 +10,6 @@ 正式桌面 Release 发布或编辑后,`.github/workflows/sync-website.yml` 仅按事件中的 Release ID 读取该版本的当前内容,创建或更新官网 `src/content/releases/<版本号>.md`,不遍历历史 Release 或官网文件树,也不自动补齐历史记录。Markdown frontmatter 保存版本、发布日期与来源链接,正文保留 Release 原文;无正文时显示未填写说明。仅当该版本高于官网 `desktopVersion` 时才更新下载版本;编辑旧版说明只更新该版本文件,不会降级下载入口。当前或更新版本缺少任一平台安装包时失败,旧版说明同步不检查安装包。版本变量与当前发布文件的变化通过 Git Trees API 在同一个 commit 中提交到 `joinTARP/web-site` 的 `main` 分支,内容相同则不提交,不修改其他版本文件或列表页 Markdown。草稿、预发布、CLI 发布不触发同步。官网托管平台需已连接该仓库,并启用 `main` 分支 push 自动构建。 -同步工作流文件推送到 `main` 时,仅执行不读取 Secret 的入口检查,以便 GitHub Actions 注册并显示工作流;普通源码 push 不触发它,也不会因此同步官网。 - 已发布版本不需要删除 Release 或移动标签。先合入官网改动,再将同步工作流合入桌面仓库默认分支并配置下述 Secret,随后打开桌面仓库 **Actions → 同步官网桌面版本与更新记录 → Run workflow**,选择默认分支,在 `tag` 填写真实发布标签(如 `desktop-v0.1.1`)后运行。手动入口只读取指定 Release,仍会拒绝草稿、预发布和不符合格式的标签;重复运行不会重复提交。旧标签对应的提交若尚未包含本工作流,编辑该 Release 不会触发新增工作流,使用手动入口补同步即可。不要为启用官网同步覆盖既有发布标签或重新打包。 首次使用需在桌面仓库 Actions Secrets 配置 `WEBSITE_CONTENTS_TOKEN`:使用 fine-grained PAT,仅选择 `joinTARP/web-site`,授予 **Contents: Read and write**,并确保组织已批准该 Token(如需审批)。Token 所属账号需有官网仓库写权限,且 `main` 分支规则允许该账号直接提交。默认 `GITHUB_TOKEN` 仅限当前仓库,不能用于此跨仓库提交。工作流文件须先合入桌面仓库默认分支,官网的 `desktopVersion`、带版本号的链接模板与发布内容集合、列表及详情页也须先提交到 `main`。同一 Release 的任务串行执行,不同 Release 使用独立并发组,避免互相取消排队任务。同步使用官网当前提交作为父提交和基础文件树,非强制更新分支;并发修改导致更新失败时不会覆盖他人提交,可重跑失败任务。同步提交的作者为 Token 所属账号;Token 缺失、过期或写入被分支规则拒绝时,工作流失败,不宣称官网已更新。