Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

ci: promote verified desktop release candidates

Leggettda9a3b583177
diff --git a/.codex/skills/oc-deploy/SKILL.md b/.codex/skills/oc-deploy/SKILL.md
index 86c8b6cd..fb7c5fb1 100644
--- a/.codex/skills/oc-deploy/SKILL.md
+++ b/.codex/skills/oc-deploy/SKILL.md
@@ -24,9 +24,9 @@ description: 验证、诊断和发布 OpenCreator Desktop,包括本地实际 A
4. 任何 GitHub 构建前,确认精确提交已有成功的 `master` push CI;确认 workflow 的 `publish` 仍只允许 tag ref。
5. GitHub 下载和 `gh` 命令设置 `HTTP_PROXY` 与 `HTTPS_PROXY` 为 `http://127.0.0.1:7897`,并先用 `gh auth status` 确认认证身份。GitHub 保存的签名 secrets 会跨 workflow 运行持续存在,不要要求重复上传。
6. 不用付费 Release 构建逐次发现问题。一次远端运行首次出现 package、E2E、签名、公证或上传失败时,立即取消仍在运行的付费 sibling jobs,读取该 run 的已生成日志和 artifacts;不得为了拿日志直接 rerun。
-7. candidate 只能通过 `workflow_dispatch` 从 `master` 运行。结束后确认 `publish` skipped、artifacts 已生成,并确认 tag 和 Release 均未变化。
-8. release 只能对已经通过上述门禁的精确 commit 创建 tag。不得在失败后盲目移动 tag;先本地修复、重新通过门禁和 master CI,再按用户明确授权处理 tag。
+7. candidate 只能通过 `workflow_dispatch` 从 `master` 运行。正式发布候选必须选择 `target=all`;结束后确认候选身份凭据和全部 artifacts 已生成、`publish` skipped,并确认 tag 和 Release 均未变化。单平台 candidate 只用于诊断,不能提升为 Release。
+8. release 只能对已经通过上述门禁和完整 candidate 的精确 commit 创建 tag。tag workflow 必须提升该 candidate 的不可变 artifacts,不得重新执行付费打包。不得在失败后盲目移动 tag;先本地修复、重新通过门禁、master CI 和完整 candidate,再按用户明确授权处理 tag。
## 完成标准
-报告精确 commit、本地打包平台、本地 App 路径、包校验与 E2E 结果、master CI、GitHub run URL、各 job 结果及 artifacts。candidate 明确说明未创建 tag/Release;release 列出 tag 和发布附件。任何未执行门禁都必须说明原因和残余风险,不得声称可发布。
+报告精确 commit、本地打包平台、本地 App 路径、包校验与 E2E 结果、master CI、candidate run URL、各 job 结果、候选身份凭据及 artifacts。candidate 明确说明未创建 tag/Release;release 同时列出被提升的 candidate run、tag 和发布附件。任何未执行门禁都必须说明原因和残余风险,不得声称可发布。
diff --git a/.codex/skills/oc-deploy/references/runbook.md b/.codex/skills/oc-deploy/references/runbook.md
index 2a3782e1..fc63439b 100644
--- a/.codex/skills/oc-deploy/references/runbook.md
+++ b/.codex/skills/oc-deploy/references/runbook.md
@@ -66,9 +66,9 @@ gh workflow run desktop-release.yml --repo krillinai/OpenCreator --ref master -f
```
5. 任一 package job 首次失败,立即 `gh run cancel <run-id>`,再读取失败日志;不要自动重跑。
-6. 成功标准:verify、目标 package jobs 和 Linux package 成功;用户附件与 KrillinAI 附件存在;publish skipped;tag 和 Release 未变化。
+6. `target=all` 的成功标准:verify、三个 package jobs、Linux package 和 `candidate-ready` 成功;用户附件、KrillinAI 附件及 `opencreator-release-candidate-<commit>` 身份凭据存在;publish skipped;tag 和 Release 未变化。
-只验证某个已知平台问题时,可在用户同意后选单平台 target 以节省费用;完整跨平台候选验收使用 `all`。
+只验证某个已知平台问题时,可在用户同意后选单平台 target 以节省费用;单平台结果不能用于正式发布,完整跨平台候选验收必须使用 `all`。
## Release:正式 tag 发布
@@ -76,9 +76,10 @@ release 是独立授权边界。用户必须明确指定版本并要求发布:
1. 确认版本、目标 commit、工作区、`origin/master`、同 commit 本地 preflight 和 master push CI。
2. 确认 tag 不存在;已存在时由用户明确决定,不自行覆盖。
-3. 创建并推送一次 tag,监控由 tag 触发的唯一 Release run。
-4. 首次失败立即取消其他付费 jobs并诊断,不 rerun,不先移动 tag。
-5. 成功后验证 Release 非 draft、附件完整、命名和下载说明正确。
+3. 确认完整 candidate run 已生成与目标 commit 绑定的身份凭据和全部附件。
+4. 创建并推送一次 tag,监控由 tag 触发的唯一 promotion run。tag workflow 只能下载并校验该 candidate 的 artifacts,不得重新打包、签名、公证或运行 packaged App E2E。
+5. promotion 失败时读取候选解析、身份凭据或附件校验错误,不通过移动 tag 或重新付费打包绕过。
+6. 成功后验证 Release 非 draft、附件完整、命名和下载说明正确,并记录被提升的 candidate run。
## 故障分类与已知陷阱
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml
index e6de0381..d4083a9b 100644
--- a/.github/workflows/desktop-release.yml
+++ b/.github/workflows/desktop-release.yml
@@ -84,6 +84,7 @@ jobs:
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
package:
+ if: github.event_name == 'workflow_dispatch'
needs: verify
timeout-minutes: 90
strategy:
@@ -213,7 +214,7 @@ jobs:
retention-days: 14
krillinai-linux-package:
- if: startsWith(github.ref, 'refs/tags/') || inputs.target == 'all'
+ if: github.event_name == 'workflow_dispatch' && inputs.target == 'all'
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 20
@@ -241,27 +242,119 @@ jobs:
path: .runtime/release/krillinai/*
if-no-files-found: error
- publish:
- if: startsWith(github.ref, 'refs/tags/v')
+ candidate-ready:
+ if: github.event_name == 'workflow_dispatch' && inputs.target == 'all'
needs:
- package
- krillinai-linux-package
runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - name: 记录可提升候选包
+ env:
+ CANDIDATE_SHA: ${{ github.sha }}
+ CANDIDATE_RUN_ID: ${{ github.run_id }}
+ CANDIDATE_REPOSITORY: ${{ github.repository }}
+ run: |
+ node -e '
+ const fs = require("node:fs");
+ const candidate = {
+ schemaVersion: 1,
+ commit: process.env.CANDIDATE_SHA,
+ runId: Number(process.env.CANDIDATE_RUN_ID),
+ repository: process.env.CANDIDATE_REPOSITORY,
+ event: "workflow_dispatch",
+ target: "all"
+ };
+ fs.writeFileSync("release-candidate.json", `${JSON.stringify(candidate, null, 2)}\n`);
+ '
+ - name: 上传候选包身份凭据
+ uses: actions/upload-artifact@v4
+ with:
+ name: opencreator-release-candidate-${{ github.sha }}
+ path: release-candidate.json
+ if-no-files-found: error
+ retention-days: 90
+
+ publish:
+ if: startsWith(github.ref, 'refs/tags/v')
+ needs: verify
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ permissions:
+ actions: read
+ contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
+ - name: 查找同一提交的完整候选构建
+ id: candidate
+ env:
+ GH_TOKEN: ${{ github.token }}
+ GH_REPO: ${{ github.repository }}
+ CANDIDATE_NAME: opencreator-release-candidate-${{ github.sha }}
+ shell: bash
+ run: |
+ run_id="$(
+ gh api --method GET "repos/$GH_REPO/actions/artifacts" \
+ -f name="$CANDIDATE_NAME" \
+ --jq '.artifacts | map(select(.expired == false)) | sort_by(.created_at) | reverse | .[0].workflow_run.id // empty'
+ )"
+ if [[ -z "$run_id" ]]; then
+ echo "::error::提交 $GITHUB_SHA 没有通过 target=all 的完整候选构建。请先从 master 手动运行 OpenCreator Release。"
+ exit 1
+ fi
+
+ run="$(gh api "repos/$GH_REPO/actions/runs/$run_id")"
+ if [[ "$(jq -r '.event' <<< "$run")" != "workflow_dispatch" \
+ || "$(jq -r '.head_branch' <<< "$run")" != "master" \
+ || "$(jq -r '.head_sha' <<< "$run")" != "$GITHUB_SHA" \
+ || "$(jq -r '.conclusion' <<< "$run")" != "success" \
+ || "$(jq -r '.path' <<< "$run")" != ".github/workflows/desktop-release.yml" ]]; then
+ echo "::error::候选构建 $run_id 与当前 tag 的提交或发布工作流不匹配。"
+ exit 1
+ fi
+ echo "run-id=$run_id" >> "$GITHUB_OUTPUT"
+ echo "使用已验证候选构建:$run_id"
- uses: actions/download-artifact@v4
with:
+ github-token: ${{ github.token }}
+ run-id: ${{ steps.candidate.outputs.run-id }}
path: artifacts
pattern: opencreator-desktop-*
merge-multiple: true
- uses: actions/download-artifact@v4
with:
+ github-token: ${{ github.token }}
+ run-id: ${{ steps.candidate.outputs.run-id }}
path: artifacts
pattern: krillinai-release-*
merge-multiple: true
+ - uses: actions/download-artifact@v4
+ with:
+ github-token: ${{ github.token }}
+ run-id: ${{ steps.candidate.outputs.run-id }}
+ name: opencreator-release-candidate-${{ github.sha }}
+ path: candidate
+ - name: 校验候选包身份凭据
+ env:
+ EXPECTED_SHA: ${{ github.sha }}
+ EXPECTED_RUN_ID: ${{ steps.candidate.outputs.run-id }}
+ EXPECTED_REPOSITORY: ${{ github.repository }}
+ run: |
+ node -e '
+ const fs = require("node:fs");
+ const candidate = JSON.parse(fs.readFileSync("candidate/release-candidate.json", "utf8"));
+ const valid = candidate.schemaVersion === 1
+ && candidate.commit === process.env.EXPECTED_SHA
+ && String(candidate.runId) === process.env.EXPECTED_RUN_ID
+ && candidate.repository === process.env.EXPECTED_REPOSITORY
+ && candidate.event === "workflow_dispatch"
+ && candidate.target === "all";
+ if (!valid) throw new Error("Release candidate provenance does not match this tag");
+ '
- name: 校验发布附件并生成下载说明
env:
TAG: ${{ github.ref_name }}
diff --git a/apps/desktop/e2e/creator-packaged-app.spec.ts b/apps/desktop/e2e/creator-packaged-app.spec.ts
index 11a5d198..2cf8c5e8 100644
--- a/apps/desktop/e2e/creator-packaged-app.spec.ts
+++ b/apps/desktop/e2e/creator-packaged-app.spec.ts
@@ -850,25 +850,30 @@ test('Creator Preset verifier 拒绝损坏和陈旧的打包资源', () => {
const sourceRoot = packagedPackageRoot();
const fixtureRoot = mkdtempSync(join(tmpdir(), 'opencreator-preset-verifier-'));
const packageRoot = join(fixtureRoot, basename(sourceRoot));
- clonePackageRoot(sourceRoot, packageRoot);
- const resources = packagedResourcesRoot(packageRoot);
- const presetRoot = join(resources, 'daemon', 'runtime', 'creator-presets');
- const manifestPath = join(presetRoot, 'manifest.json');
- const catalogPath = join(presetRoot, 'catalog.json');
- const manifestBytes = readFileSync(manifestPath);
- const catalogBytes = readFileSync(catalogPath);
- const presetManifest = JSON.parse(manifestBytes.toString('utf8')) as {
- files: Array<{ path: string }>;
- };
- const coverName = basename(
- presetManifest.files.find(file => file.path.startsWith('assets/'))!.path
- );
- const coverPath = join(resources, 'web', 'creator-presets', coverName);
- const coverBytes = readFileSync(coverPath);
- const stalePath = join(resources, 'web', 'creator-presets', 'stale.webp');
try {
- expect(runPackagedVerifier(packageRoot).status).toBe(0);
+ const baseline = runPackagedVerifier(sourceRoot);
+ expect(
+ baseline.status,
+ `Packaged verifier failed:\n${baseline.stdout}\n${baseline.stderr}`
+ ).toBe(0);
+
+ clonePackageRoot(sourceRoot, packageRoot);
+ const resources = packagedResourcesRoot(packageRoot);
+ const presetRoot = join(resources, 'daemon', 'runtime', 'creator-presets');
+ const manifestPath = join(presetRoot, 'manifest.json');
+ const catalogPath = join(presetRoot, 'catalog.json');
+ const manifestBytes = readFileSync(manifestPath);
+ const catalogBytes = readFileSync(catalogPath);
+ const presetManifest = JSON.parse(manifestBytes.toString('utf8')) as {
+ files: Array<{ path: string }>;
+ };
+ const coverName = basename(
+ presetManifest.files.find(file => file.path.startsWith('assets/'))!.path
+ );
+ const coverPath = join(resources, 'web', 'creator-presets', coverName);
+ const coverBytes = readFileSync(coverPath);
+ const stalePath = join(resources, 'web', 'creator-presets', 'stale.webp');
rmSync(catalogPath);
expectVerifierFailure(
diff --git a/apps/desktop/test/release-workflow.test.mjs b/apps/desktop/test/release-workflow.test.mjs
index 1d33dba5..a8cd46e8 100644
--- a/apps/desktop/test/release-workflow.test.mjs
+++ b/apps/desktop/test/release-workflow.test.mjs
@@ -82,19 +82,32 @@ describe('Desktop release workflow', () => {
expect(releaseWorkflow).toContain('desktop-release.log');
});
- it('supports single-platform manual validation while tag releases build every platform', () => {
+ it('supports single-platform validation and only marks complete all-platform candidates', () => {
expect(releaseWorkflow).toContain('target:');
expect(releaseWorkflow).toContain('default: all');
expect(releaseWorkflow).toContain("TARGET: ${{ inputs.target || 'all' }}");
- expect(releaseWorkflow).toContain(
- 'matrix: ${{ fromJSON(needs.verify.outputs.matrix) }}'
- );
+ expect(releaseWorkflow).toContain('matrix: ${{ fromJSON(needs.verify.outputs.matrix) }}');
expect(releaseWorkflow).toContain(
'{"include":[{"name":"macos-x64"'
);
expect(releaseWorkflow).toContain(
'{"include":[{"name":"windows-x64"'
);
+ expect(releaseWorkflow).toContain("candidate-ready:");
+ expect(releaseWorkflow).toContain("inputs.target == 'all'");
+ expect(releaseWorkflow).toContain('opencreator-release-candidate-${{ github.sha }}');
+ });
+
+ it('promotes an immutable successful master candidate instead of rebuilding a tag', () => {
+ expect(releaseWorkflow).toContain("if: github.event_name == 'workflow_dispatch'");
+ expect(releaseWorkflow).toContain('name: 查找同一提交的完整候选构建');
+ expect(releaseWorkflow).toContain("jq -r '.head_branch'");
+ expect(releaseWorkflow).toContain("jq -r '.head_sha'");
+ expect(releaseWorkflow).toContain("jq -r '.conclusion'");
+ expect(releaseWorkflow).toContain('run-id: ${{ steps.candidate.outputs.run-id }}');
+ expect(releaseWorkflow).toContain('name: 校验候选包身份凭据');
+ expect(releaseWorkflow).toContain('needs: verify');
+ expect(releaseWorkflow).not.toContain("startsWith(github.ref, 'refs/tags/') || inputs.target == 'all'");
});
it('keeps build diagnostics separate from validated public release assets', () => {
diff --git a/docs/operations/opencreator-desktop-release-runbook.md b/docs/operations/opencreator-desktop-release-runbook.md
index 4ed3bd57..cf265d2d 100644
--- a/docs/operations/opencreator-desktop-release-runbook.md
+++ b/docs/operations/opencreator-desktop-release-runbook.md
@@ -43,13 +43,17 @@ pnpm desktop:package
1. 更新 `apps/desktop/package.json` 的版本。
2. 确认 GitHub Release 发布权限、签名凭据和目标版本更新元数据流程可用。
-3. 先推送版本提交到 `master`,手动运行 CI 并等待同一提交验证通过,再创建并推送 `v<version>` Git tag 触发 `.github/workflows/desktop-release.yml`。标签版本必须与 `apps/desktop/package.json` 完全一致。
-4. 发布工作流复用同一提交的 CI 结果,再使用 `macos-15-intel`、`macos-15` 和 `windows-latest` 并行构建三个原生目标平台。
-5. 三个平台的实际打包应用 E2E 通过后,CI 校验附件白名单,生成下载说明与校验清单,上传完成后才公开 GitHub Release。
+3. 先推送版本提交到 `master`,等待同一提交的 CI 通过,再从 `master` 手动运行 `.github/workflows/desktop-release.yml`,并选择 `target=all`。
+4. 完整候选工作流使用 `macos-15-intel`、`macos-15` 和 `windows-latest` 并行构建三个原生目标平台。macOS 使用正式 Developer ID 签名和 Apple 公证;每个平台都必须通过实际打包应用 E2E。单平台运行只用于诊断,不能用于正式发布。
+5. 三个平台和 Linux KrillinAI 附件全部成功后,工作流写入绑定 Git commit、workflow run 和仓库的候选身份凭据。候选附件保存于该 workflow run,不允许构建后替换。
+6. 候选全绿后才创建并推送 `v<version>` Git tag。标签版本必须与 `apps/desktop/package.json` 完全一致,且 tag 必须指向候选使用的同一 commit。
+7. tag 工作流不再重复构建、签名、公证或 E2E;它只查找同一 commit 的成功 `target=all` 候选,复核 run 与身份凭据,下载已验证附件,校验附件白名单并发布 GitHub Release。找不到精确候选时必须失败。
示例:
```bash
+gh workflow run desktop-release.yml --ref master -f target=all
+# 等待候选工作流全部通过后再创建 tag
git tag -a v3.0.0 -m "OpenCreator v3.0.0"
git push origin v3.0.0
```