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.

build: publish OpenCreator and KrillinAI release packages

wuliendc5989b33ddc
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml
index 5569bc81..0aff3049 100644
--- a/.github/workflows/desktop-release.yml
+++ b/.github/workflows/desktop-release.yml
@@ -1,4 +1,4 @@
-name: Desktop Release
+name: OpenCreator Release
on:
workflow_dispatch:
@@ -163,12 +163,23 @@ jobs:
OPENCREATOR_DESKTOP_TARGET_ARCH: ${{ matrix.arch }}
- name: 验证实际打包应用
run: pnpm --filter @opencreator/desktop e2e:package
+ - name: 生成 KrillinAI Server 与 CLI 独立发布包
+ run: pnpm krillinai:package
+ env:
+ OPENCREATOR_KRILLINAI_TARGET_PLATFORM: ${{ matrix.platform }}
+ OPENCREATOR_KRILLINAI_TARGET_ARCH: ${{ matrix.arch }}
- name: 上传用户发布附件
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ env.OPENCREATOR_DESKTOP_RELEASE_ASSETS }}/*
if-no-files-found: error
+ - name: 上传 KrillinAI Server 与 CLI 发布附件
+ uses: actions/upload-artifact@v4
+ with:
+ name: krillinai-release-${{ matrix.name }}
+ path: ${{ env.OPENCREATOR_KRILLINAI_RELEASE_ASSETS }}/*
+ if-no-files-found: error
- name: 保留内部构建诊断
if: always()
uses: actions/upload-artifact@v4
@@ -182,9 +193,40 @@ jobs:
if-no-files-found: ignore
retention-days: 14
+ krillinai-linux-package:
+ if: startsWith(github.ref, 'refs/tags/') || inputs.target == 'all'
+ needs: verify
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ - uses: actions/setup-go@v5
+ with:
+ go-version-file: runtime/krillinai/go.mod
+ cache-dependency-path: runtime/krillinai/go.sum
+ - name: 生成 Linux KrillinAI Server 与 CLI 发布包
+ shell: bash
+ run: |
+ for arch in x64 arm64; do
+ OPENCREATOR_KRILLINAI_TARGET_PLATFORM=linux \
+ OPENCREATOR_KRILLINAI_TARGET_ARCH="$arch" \
+ node scripts/package-krillinai-release.mjs
+ done
+ - name: 上传 Linux KrillinAI Server 与 CLI 发布附件
+ uses: actions/upload-artifact@v4
+ with:
+ name: krillinai-release-linux
+ path: .runtime/release/krillinai/*
+ if-no-files-found: error
+
publish:
if: startsWith(github.ref, 'refs/tags/v')
- needs: package
+ needs:
+ - package
+ - krillinai-linux-package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -196,6 +238,11 @@ jobs:
path: artifacts
pattern: opencreator-desktop-*
merge-multiple: true
+ - uses: actions/download-artifact@v4
+ with:
+ path: artifacts
+ pattern: krillinai-release-*
+ merge-multiple: true
- name: 校验发布附件并生成下载说明
env:
TAG: ${{ github.ref_name }}
@@ -207,6 +254,6 @@ jobs:
GH_REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
- gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" --verify-tag --draft --title "KrillinAI $TAG" --notes-file release-notes.md
+ gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" --verify-tag --draft --title "OpenCreator $TAG" --notes-file release-notes.md
find artifacts -maxdepth 1 -type f -print0 | xargs -0 gh release upload "$TAG" --clobber
- gh release edit "$TAG" --draft=false --latest --title "KrillinAI $TAG" --notes-file release-notes.md
+ gh release edit "$TAG" --draft=false --latest --title "OpenCreator $TAG" --notes-file release-notes.md
diff --git a/README.md b/README.md
index 63c0e002..849446a5 100644
--- a/README.md
+++ b/README.md
@@ -265,6 +265,7 @@ pnpm desktop:dev
| `pnpm desktop:dist` | An installer for the current platform |
| `pnpm desktop:release` | The formal release packaging entry point |
| `pnpm --filter @opencreator/desktop verify:package` | Verification for an existing Desktop package |
+| `pnpm krillinai:package` | Separate KrillinAI Server and CLI archives for the selected platform |
Desktop packaging rebuilds Web from the current workspace, records the commit, dirty state, platform, architecture, and Web hash, and compares `apps/web/dist` with the resources embedded in the application. Packaging fails if they differ. See the [Desktop release runbook](./docs/operations/opencreator-desktop-release-runbook.md) for signing, notarization, Windows builds, and release requirements.
@@ -485,15 +486,15 @@ The root `README.md` is the canonical English document. Maintained translations
Thanks to everyone who has taken part through code, documentation, feedback, issue reports, Skills, designs, and ideas.
-<a href="https://github.com/krillinai/KrillinAI/graphs/contributors">
- <img src="https://contrib.rocks/image?repo=krillinai/KrillinAI&amp;max=500&amp;columns=20" alt="OpenCreator contributors" />
+<a href="https://github.com/krillinai/OpenCreator/graphs/contributors">
+ <img src="https://contrib.rocks/image?repo=krillinai/OpenCreator&amp;max=500&amp;columns=20" alt="OpenCreator contributors" />
</a>
## Star History
OpenCreator was formerly named KrillinAI. This chart covers the repository's full history across the rename.
-[![OpenCreator Star History](https://api.star-history.com/svg?repos=krillinai/KrillinAI&type=Date)](https://star-history.com/#krillinai/KrillinAI&Date)
+[![OpenCreator Star History](https://api.star-history.com/svg?repos=krillinai/OpenCreator&type=Date)](https://star-history.com/#krillinai/OpenCreator&Date)
## Related Projects
diff --git a/apps/desktop/electron-builder.yml b/apps/desktop/electron-builder.yml
index cb28e1b5..c4632071 100644
--- a/apps/desktop/electron-builder.yml
+++ b/apps/desktop/electron-builder.yml
@@ -1,6 +1,6 @@
appId: com.opencreator.desktop
productName: OpenCreator
-artifactName: KrillinAI-${version}-${os}-${arch}.${ext}
+artifactName: OpenCreator-${version}-${os}-${arch}.${ext}
asar: true
npmRebuild: false
electronFuses:
@@ -60,7 +60,7 @@ protocols:
publish:
provider: github
owner: krillinai
- repo: KrillinAI
+ repo: OpenCreator
afterPack: ./scripts/sign-creator-runtime-after-pack.mjs
afterSign: ./scripts/notarize-after-sign.mjs
mac:
diff --git a/apps/desktop/scripts/release-assets.mjs b/apps/desktop/scripts/release-assets.mjs
index e73708cd..5ecd2b6b 100644
--- a/apps/desktop/scripts/release-assets.mjs
+++ b/apps/desktop/scripts/release-assets.mjs
@@ -9,14 +9,18 @@ const releasePlatforms = [
{ platform: 'win32', arch: 'x64', label: 'Windows x64' }
];
+const krillinReleasePlatforms = [
+ ...releasePlatforms,
+ { platform: 'linux', arch: 'x64', label: 'Linux x64' },
+ { platform: 'linux', arch: 'arm64', label: 'Linux ARM64' }
+];
+
export function releaseAssetNames(version, platform, arch) {
- if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version)) {
- throw new Error(`Invalid release version: ${version}`);
- }
+ assertVersion(version);
if (!releasePlatforms.some(target => target.platform === platform && target.arch === arch)) {
throw new Error(`Unsupported release platform: ${platform}-${arch}`);
}
- const prefix = `KrillinAI-${version}-${platform === 'darwin' ? 'mac' : 'win'}-${arch}`;
+ const prefix = `OpenCreator-${version}-${platform === 'darwin' ? 'mac' : 'win'}-${arch}`;
if (platform === 'win32') return [`${prefix}.exe`, 'latest.yml'];
return [
`${prefix}.dmg`,
@@ -26,6 +30,25 @@ export function releaseAssetNames(version, platform, arch) {
];
}
+export function krillinReleaseAssetNames(version, platform, arch) {
+ assertVersion(version);
+ if (!krillinReleasePlatforms.some(target => (
+ target.platform === platform && target.arch === arch
+ ))) {
+ throw new Error(`Unsupported KrillinAI release platform: ${platform}-${arch}`);
+ }
+ const os = platform === 'darwin'
+ ? 'mac'
+ : platform === 'win32'
+ ? 'win'
+ : 'linux';
+ const extension = platform === 'win32' ? 'zip' : 'tar.gz';
+ return [
+ `KrillinAI-Server-${version}-${os}-${arch}.${extension}`,
+ `KrillinAI-CLI-${version}-${os}-${arch}.${extension}`
+ ];
+}
+
function sha256(path) {
return createHash('sha256').update(readFileSync(path)).digest('hex');
}
@@ -61,7 +84,13 @@ function writeChecksums(directory, names) {
}
export function finalizeReleaseAssets({ directory, version, repository }) {
- const expected = releasePlatforms.flatMap(({ platform, arch }) => releaseAssetNames(version, platform, arch));
+ const desktopAssets = releasePlatforms.flatMap(
+ ({ platform, arch }) => releaseAssetNames(version, platform, arch)
+ );
+ const krillinAssets = krillinReleasePlatforms.flatMap(
+ ({ platform, arch }) => krillinReleaseAssetNames(version, platform, arch)
+ );
+ const expected = [...desktopAssets, ...krillinAssets];
const actual = readdirSync(directory, { withFileTypes: true });
for (const entry of actual) {
if (!entry.isFile() || (!expected.includes(entry.name) && entry.name !== 'SHA256SUMS.txt')) {
@@ -73,18 +102,36 @@ export function finalizeReleaseAssets({ directory, version, repository }) {
}
writeChecksums(directory, expected);
const downloadRoot = `https://github.com/${repository}/releases/download/v${version}`;
- const rows = releasePlatforms.map(({ platform, arch, label }) => {
+ const desktopRows = releasePlatforms.map(({ platform, arch, label }) => {
const installer = releaseAssetNames(version, platform, arch)[0];
return `| ${label} | [${installer}](${downloadRoot}/${installer}) |`;
});
+ const krillinRows = (assetIndex) => krillinReleasePlatforms.map(
+ ({ platform, arch, label }) => {
+ const asset = krillinReleaseAssetNames(version, platform, arch)[assetIndex];
+ return `| ${label} | [${asset}](${downloadRoot}/${asset}) |`;
+ }
+ );
return [
- `# KrillinAI v${version}`,
+ `# OpenCreator v${version}`,
'',
- '## 下载',
+ '## OpenCreator 桌面端',
'',
'| 平台 | 安装包 |',
'| --- | --- |',
- ...rows,
+ ...desktopRows,
+ '',
+ '## KrillinAI Server',
+ '',
+ '| 平台 | 服务端程序 |',
+ '| --- | --- |',
+ ...krillinRows(0),
+ '',
+ '## KrillinAI CLI',
+ '',
+ '| 平台 | CLI 程序 |',
+ '| --- | --- |',
+ ...krillinRows(1),
'',
`[SHA-256 校验清单](${downloadRoot}/SHA256SUMS.txt)`,
'',
@@ -94,13 +141,19 @@ export function finalizeReleaseAssets({ directory, version, repository }) {
'<summary>自动更新附件</summary>',
'',
'ZIP、ZIP blockmap 和 latest YAML 供客户端自动更新使用,手动安装只需下载上表对应的安装包。',
- '构建清单、调试配置和独立 CLI/Server 程序不作为桌面版下载附件发布。',
+ '构建清单和调试配置不作为公开下载附件发布。',
'',
'</details>',
''
].join('\n');
}
+function assertVersion(version) {
+ if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version)) {
+ throw new Error(`Invalid release version: ${version}`);
+ }
+}
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
try {
const [directory, tag, repository, notesPath] = process.argv.slice(2);
diff --git a/apps/desktop/test/krillinai-release-package.test.mjs b/apps/desktop/test/krillinai-release-package.test.mjs
new file mode 100644
index 00000000..90570a6a
--- /dev/null
+++ b/apps/desktop/test/krillinai-release-package.test.mjs
@@ -0,0 +1,118 @@
+import { createHash } from 'node:crypto';
+import { execFileSync } from 'node:child_process';
+import {
+ mkdirSync,
+ mkdtempSync,
+ readFileSync,
+ rmSync,
+ writeFileSync
+} from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join, resolve } from 'node:path';
+import { afterEach, describe, expect, it } from 'vitest';
+import { packageKrillinRelease } from '../../../scripts/package-krillinai-release.mjs';
+
+const directories = [];
+
+afterEach(() => {
+ for (const directory of directories.splice(0)) {
+ rmSync(directory, { recursive: true, force: true });
+ }
+});
+
+describe('KrillinAI release packages', () => {
+ it('creates separate Server and CLI archives with only their own executable', () => {
+ const fixture = createFixture();
+ const result = packageKrillinRelease({
+ rootDir: fixture.root,
+ buildRoot: fixture.buildRoot,
+ outputDir: fixture.outputDir,
+ version: '3.0.0',
+ platform: 'darwin',
+ arch: 'arm64',
+ build: false
+ });
+
+ expect(result.assets.map(asset => asset.name)).toEqual([
+ 'KrillinAI-Server-3.0.0-mac-arm64.tar.gz',
+ 'KrillinAI-CLI-3.0.0-mac-arm64.tar.gz'
+ ]);
+ const serverFiles = archiveFiles(result.assets[0].path);
+ const cliFiles = archiveFiles(result.assets[1].path);
+ expect(serverFiles).toContain(
+ 'KrillinAI-Server-3.0.0-mac-arm64/krillinai-server'
+ );
+ expect(serverFiles).not.toContain(
+ 'KrillinAI-Server-3.0.0-mac-arm64/krillinai-cli'
+ );
+ expect(cliFiles).toContain(
+ 'KrillinAI-CLI-3.0.0-mac-arm64/krillinai-cli'
+ );
+ expect(cliFiles).not.toContain(
+ 'KrillinAI-CLI-3.0.0-mac-arm64/krillinai-server'
+ );
+ for (const files of [serverFiles, cliFiles]) {
+ expect(files.some(path => path.endsWith('/config/config-example.toml'))).toBe(true);
+ expect(files.some(path => path.endsWith('/config/subtitle-style-default.json'))).toBe(true);
+ expect(files.some(path => path.endsWith('/LICENSE'))).toBe(true);
+ }
+ });
+
+ it('rejects binaries that changed after the build manifest was written', () => {
+ const fixture = createFixture();
+ writeFileSync(join(fixture.buildRoot, 'bin', 'krillinai-cli'), 'modified');
+ expect(() => packageKrillinRelease({
+ rootDir: fixture.root,
+ buildRoot: fixture.buildRoot,
+ outputDir: fixture.outputDir,
+ version: '3.0.0',
+ platform: 'darwin',
+ arch: 'arm64',
+ build: false
+ })).toThrow('hash mismatch');
+ });
+});
+
+function createFixture() {
+ const root = mkdtempSync(join(tmpdir(), 'krillinai-package-fixture-'));
+ directories.push(root);
+ const buildRoot = join(root, 'build');
+ const outputDir = join(root, 'release');
+ const configDir = join(root, 'runtime', 'krillinai', 'config');
+ const binDir = join(buildRoot, 'bin');
+ mkdirSync(configDir, { recursive: true });
+ mkdirSync(binDir, { recursive: true });
+ writeFileSync(join(configDir, 'config-example.toml'), '[server]\nport = 8888\n');
+ writeFileSync(join(configDir, 'subtitle-style-default.json'), '{"version":1}\n');
+ writeFileSync(join(root, 'runtime', 'krillinai', 'LICENSE'), 'license\n');
+ const binaries = {};
+ for (const name of ['krillinai-server', 'krillinai-cli']) {
+ const path = join(binDir, name);
+ writeFileSync(path, `${name}\n`);
+ binaries[name] = {
+ path: `bin/${name}`,
+ sha256: hashFile(path)
+ };
+ }
+ writeFileSync(join(buildRoot, 'manifest.json'), JSON.stringify({
+ version: 1,
+ component: 'opencreator-krillinai',
+ componentVersion: '3.0.0',
+ platform: 'darwin',
+ arch: 'arm64',
+ buildVcs: false,
+ binaries
+ }));
+ return { root, buildRoot, outputDir };
+}
+
+function archiveFiles(path) {
+ return execFileSync('tar', ['-tzf', path], { encoding: 'utf8' })
+ .trim()
+ .split(/\r?\n/)
+ .filter(Boolean);
+}
+
+function hashFile(path) {
+ return createHash('sha256').update(readFileSync(path)).digest('hex');
+}
diff --git a/apps/desktop/test/release-assets.test.mjs b/apps/desktop/test/release-assets.test.mjs
index 76259fc9..fd8fab24 100644
--- a/apps/desktop/test/release-assets.test.mjs
+++ b/apps/desktop/test/release-assets.test.mjs
@@ -3,7 +3,12 @@ import { mkdtempSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSyn
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { afterEach, describe, expect, it } from 'vitest';
-import { finalizeReleaseAssets, releaseAssetNames, stageReleaseAssets } from '../scripts/release-assets.mjs';
+import {
+ finalizeReleaseAssets,
+ krillinReleaseAssetNames,
+ releaseAssetNames,
+ stageReleaseAssets
+} from '../scripts/release-assets.mjs';
const version = '3.0.0';
const directories = [];
@@ -13,7 +18,7 @@ afterEach(() => {
});
function fixture(platform = 'darwin', arch = 'arm64') {
- const directory = mkdtempSync(join(tmpdir(), 'krillinai-release-assets-'));
+ const directory = mkdtempSync(join(tmpdir(), 'opencreator-release-assets-'));
directories.push(directory);
const assetsDir = join(directory, 'publish');
const names = releaseAssetNames(version, platform, arch);
@@ -31,7 +36,7 @@ describe('Desktop release assets', () => {
const data = fixture();
const extraNames = [
'krillinai-cli-darwin-arm64', 'krillinai-build-manifest-darwin-arm64.json',
- 'builder-effective-config.yaml', 'KrillinAI-3.0.0-mac-arm64.dmg.blockmap'
+ 'builder-effective-config.yaml', 'OpenCreator-3.0.0-mac-arm64.dmg.blockmap'
];
for (const name of extraNames) {
const path = join(data.directory, name);
@@ -65,30 +70,64 @@ describe('Desktop release assets', () => {
expect(releaseAssetNames(version, 'darwin', 'arm64')).toContain('latest-mac.yml');
expect(() => releaseAssetNames(version, 'linux', 'x64')).toThrow('Unsupported');
expect(() => releaseAssetNames('../3.0.0', 'win32', 'x64')).toThrow('Invalid release version');
+ expect(krillinReleaseAssetNames(version, 'linux', 'arm64')).toEqual([
+ 'KrillinAI-Server-3.0.0-linux-arm64.tar.gz',
+ 'KrillinAI-CLI-3.0.0-linux-arm64.tar.gz'
+ ]);
+ expect(krillinReleaseAssetNames(version, 'win32', 'x64')).toEqual([
+ 'KrillinAI-Server-3.0.0-win-x64.zip',
+ 'KrillinAI-CLI-3.0.0-win-x64.zip'
+ ]);
+ expect(() => krillinReleaseAssetNames(version, 'win32', 'arm64')).toThrow('Unsupported');
});
- it('finalizes 11 public assets with platform download links and checksums', () => {
+ it('finalizes desktop, server, and CLI assets with download links and checksums', () => {
const data = fixture();
for (const [platform, arch] of [['darwin', 'x64'], ['win32', 'x64']]) {
for (const name of releaseAssetNames(version, platform, arch)) writeFileSync(join(data.directory, name), name);
}
- const notes = finalizeReleaseAssets({ directory: data.directory, version, repository: 'krillinai/KrillinAI' });
- expect(readdirSync(data.directory)).toHaveLength(11);
- expect(readFileSync(join(data.directory, 'SHA256SUMS.txt'), 'utf8').trim().split('\n')).toHaveLength(10);
- expect(notes).toContain('https://github.com/krillinai/KrillinAI/releases/download/v3.0.0/KrillinAI-3.0.0-win-x64.exe');
+ for (const [platform, arch] of [
+ ['darwin', 'arm64'],
+ ['darwin', 'x64'],
+ ['win32', 'x64'],
+ ['linux', 'x64'],
+ ['linux', 'arm64']
+ ]) {
+ for (const name of krillinReleaseAssetNames(version, platform, arch)) {
+ writeFileSync(join(data.directory, name), name);
+ }
+ }
+ const notes = finalizeReleaseAssets({
+ directory: data.directory,
+ version,
+ repository: 'krillinai/OpenCreator'
+ });
+ expect(readdirSync(data.directory)).toHaveLength(21);
+ expect(readFileSync(join(data.directory, 'SHA256SUMS.txt'), 'utf8').trim().split('\n')).toHaveLength(20);
+ expect(notes).toContain('https://github.com/krillinai/OpenCreator/releases/download/v3.0.0/OpenCreator-3.0.0-win-x64.exe');
+ expect(notes).toContain('KrillinAI-Server-3.0.0-linux-x64.tar.gz');
+ expect(notes).toContain('KrillinAI-CLI-3.0.0-mac-arm64.tar.gz');
expect(notes).toContain('macOS Apple Silicon');
expect(notes).toContain('Authenticode');
writeFileSync(join(data.directory, 'builder-debug.yml'), 'private diagnostic');
- expect(() => finalizeReleaseAssets({ directory: data.directory, version, repository: 'krillinai/KrillinAI' })).toThrow('Unexpected public release asset');
+ expect(() => finalizeReleaseAssets({
+ directory: data.directory,
+ version,
+ repository: 'krillinai/OpenCreator'
+ })).toThrow('Unexpected public release asset');
rmSync(join(data.directory, 'builder-debug.yml'));
rmSync(join(data.directory, 'latest.yml'));
- expect(() => finalizeReleaseAssets({ directory: data.directory, version, repository: 'krillinai/KrillinAI' })).toThrow('Missing release asset');
+ expect(() => finalizeReleaseAssets({
+ directory: data.directory,
+ version,
+ repository: 'krillinai/OpenCreator'
+ })).toThrow('Missing release asset');
});
it('uses versioned platform filenames and the new repository for automatic updates', () => {
const config = readFileSync(resolve(process.cwd(), 'electron-builder.yml'), 'utf8');
- expect(config).toContain('artifactName: KrillinAI-${version}-${os}-${arch}.${ext}');
- expect(config).toContain('repo: KrillinAI');
- expect(config).not.toContain('repo: OpenCreator');
+ expect(config).toContain('artifactName: OpenCreator-${version}-${os}-${arch}.${ext}');
+ expect(config).toContain('repo: OpenCreator');
+ expect(config).not.toContain('repo: KrillinAI');
});
});
diff --git a/apps/desktop/test/release-workflow.test.mjs b/apps/desktop/test/release-workflow.test.mjs
index 48dd0e4e..3cbd6ce6 100644
--- a/apps/desktop/test/release-workflow.test.mjs
+++ b/apps/desktop/test/release-workflow.test.mjs
@@ -12,6 +12,12 @@ const ciWorkflow = readFileSync(
);
describe('Desktop release workflow', () => {
+ it('uses OpenCreator as the release name', () => {
+ expect(releaseWorkflow).toContain('name: OpenCreator Release');
+ expect(releaseWorkflow).toContain('--title "OpenCreator $TAG"');
+ expect(releaseWorkflow).not.toContain('--title "KrillinAI $TAG"');
+ });
+
it('runs CI on demand and for pull requests without automatic push builds', () => {
expect(ciWorkflow).toContain('workflow_dispatch:');
expect(ciWorkflow).toContain('pull_request:');
@@ -91,6 +97,8 @@ describe('Desktop release workflow', () => {
expect(releaseWorkflow).toContain('merge-multiple: true');
expect(releaseWorkflow).toContain('name: desktop-build-diagnostics-${{ matrix.name }}');
expect(releaseWorkflow).toContain('path: ${{ env.OPENCREATOR_DESKTOP_RELEASE_ASSETS }}/*');
+ expect(releaseWorkflow).toContain('pattern: krillinai-release-*');
+ expect(releaseWorkflow).toContain('path: ${{ env.OPENCREATOR_KRILLINAI_RELEASE_ASSETS }}/*');
expect(releaseWorkflow).toContain('release-assets.mjs artifacts');
expect(releaseWorkflow).not.toContain('apps/desktop/release/*.exe');
expect(releaseWorkflow).not.toContain('apps/desktop/release/krillinai-*');
@@ -98,6 +106,22 @@ describe('Desktop release workflow', () => {
expect(releaseWorkflow).toContain('--draft=false --latest');
});
+ it('publishes separate KrillinAI Server and CLI packages for desktop and Linux targets', () => {
+ expect(releaseWorkflow).toContain('run: pnpm krillinai:package');
+ expect(releaseWorkflow).toContain(
+ 'OPENCREATOR_KRILLINAI_TARGET_PLATFORM: ${{ matrix.platform }}'
+ );
+ expect(releaseWorkflow).toContain(
+ 'OPENCREATOR_KRILLINAI_TARGET_ARCH: ${{ matrix.arch }}'
+ );
+ expect(releaseWorkflow).toContain('krillinai-linux-package:');
+ expect(releaseWorkflow).toContain('for arch in x64 arm64; do');
+ expect(releaseWorkflow).toContain(
+ 'node scripts/package-krillinai-release.mjs'
+ );
+ expect(releaseWorkflow).toContain('name: krillinai-release-linux');
+ });
+
it('invalidates the Desktop cache when Creator Runtime releases change', () => {
expect(releaseWorkflow).toContain(
"'apps/desktop/scripts/creator-runtime-releases.mjs'"
diff --git a/docs/operations/opencreator-desktop-release-runbook.md b/docs/operations/opencreator-desktop-release-runbook.md
index bdf2a460..4ed3bd57 100644
--- a/docs/operations/opencreator-desktop-release-runbook.md
+++ b/docs/operations/opencreator-desktop-release-runbook.md
@@ -1,8 +1,8 @@
-# KrillinAI Desktop 发布手册
+# OpenCreator 发布手册
## 1. 适用范围
-本文用于发布 OpenCreator Desktop 的 macOS x64、macOS arm64 和 Windows x64 安装包,暂不发布 Linux。Desktop 安装包包含固定版本的 Codex CLI、KrillinAI CLI、ffmpeg、ffprobe 和 yt-dlp;Whisper CLI 与模型不进入安装包,由 KrillinAI 在功能实际需要时下载到用户数据目录。
+本文用于发布 OpenCreator Desktop 的 macOS x64、macOS arm64 和 Windows x64 安装包,以及 KrillinAI Server 和 CLI 的 macOS、Windows、Linux 独立程序包。Desktop 安装包包含固定版本的 Codex CLI、KrillinAI CLI、ffmpeg、ffprobe 和 yt-dlp;Whisper CLI 与模型不进入安装包,由 KrillinAI 在功能实际需要时下载到用户数据目录。
发布入口:
@@ -10,6 +10,12 @@
pnpm desktop:release
```
+单独生成当前目标平台的 KrillinAI Server 和 CLI 发布包:
+
+```bash
+pnpm krillinai:package
+```
+
本地仅生成可运行目录、构建清单并执行正式包校验:
```bash
@@ -44,7 +50,7 @@ pnpm desktop:package
示例:
```bash
-git tag -a v3.0.0 -m "KrillinAI v3.0.0"
+git tag -a v3.0.0 -m "OpenCreator v3.0.0"
git push origin v3.0.0
```
@@ -100,23 +106,25 @@ CI secrets:
```text
provider: github
owner: krillinai
-repo: KrillinAI
+repo: OpenCreator
```
生产运行时不依赖 `OPENCREATOR_UPDATE_URL`。测试通过注入 fake updater 隔离,不允许把开发覆盖写入正式包。
-GitHub Release 仅发布 11 个附件,另外 2 个源码归档由 GitHub 自动生成:
+GitHub Release 发布 21 个附件,另外 2 个源码归档由 GitHub 自动生成:
-1. macOS arm64:`KrillinAI-<version>-mac-arm64.dmg`、对应 ZIP、ZIP blockmap 和 `latest-mac.yml`。
-2. macOS x64:`KrillinAI-<version>-mac-x64.dmg`、对应 ZIP、ZIP blockmap 和 `latest-x64-mac.yml`。
-3. Windows x64:`KrillinAI-<version>-win-x64.exe` 和 `latest.yml`。
-4. 一份 `SHA256SUMS.txt`,覆盖以上 10 个文件。
+1. macOS arm64:`OpenCreator-<version>-mac-arm64.dmg`、对应 ZIP、ZIP blockmap 和 `latest-mac.yml`。
+2. macOS x64:`OpenCreator-<version>-mac-x64.dmg`、对应 ZIP、ZIP blockmap 和 `latest-x64-mac.yml`。
+3. Windows x64:`OpenCreator-<version>-win-x64.exe` 和 `latest.yml`。
+4. KrillinAI Server:macOS arm64、macOS x64、Windows x64、Linux x64 和 Linux arm64 共 5 个独立程序包。
+5. KrillinAI CLI:macOS arm64、macOS x64、Windows x64、Linux x64 和 Linux arm64 共 5 个独立程序包。
+6. 一份 `SHA256SUMS.txt`,覆盖以上 20 个文件。
安装包、更新文件的文件名、版本和 SHA512 保持 Electron Builder 原始输出,不在构建后重命名。macOS 更新使用 ZIP,其 DMG blockmap 不进入发布附件;Windows 当前关闭差分包,不生成独立 blockmap。
打包脚本按本次构建清单检查文件哈希,仅将白名单附件整理到 `apps/desktop/release/publish/<platform>-<arch>/`,该目录还包含本平台校验清单。发布任务合并平台附件后重新生成总校验清单;任何缺失或额外附件都会阻止发布。
-Desktop 构建清单、builder 调试配置和 E2E 报告仅保留在 `desktop-build-diagnostics-*` CI Artifact,保存 14 天。独立 CLI/Server 继续在 `.runtime/build/krillinai/` 构建,不复制到桌面发布目录。Windows 未签名说明放在 Release 正文,不再生成独立 TXT 附件。
+Desktop 构建清单、builder 调试配置和 E2E 报告仅保留在 `desktop-build-diagnostics-*` CI Artifact,保存 14 天。KrillinAI Server 和 CLI 分别封装为独立发布包,不合并为工具集;Windows 未签名说明放在 Release 正文,不再生成独立 TXT 附件。
客户端行为:
diff --git a/package.json b/package.json
index 29699b40..68c46243 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"desktop:release": "pnpm --filter @opencreator/desktop release",
"desktop:test": "pnpm --filter @opencreator/desktop test",
"krillinai:build": "node scripts/build-krillinai.mjs",
+ "krillinai:package": "node scripts/package-krillinai-release.mjs",
"krillinai:test": "node scripts/build-krillinai.mjs --test-only"
},
"devDependencies": {
diff --git a/scripts/build-krillinai.mjs b/scripts/build-krillinai.mjs
index abe660a4..39d12d5c 100644
--- a/scripts/build-krillinai.mjs
+++ b/scripts/build-krillinai.mjs
@@ -19,12 +19,14 @@ const scriptPath = fileURLToPath(import.meta.url);
const rootDir = resolve(dirname(scriptPath), '..');
const sourceRoot = join(rootDir, 'runtime', 'krillinai');
const targetPlatform = normalizePlatform(
- process.env.OPENCREATOR_DESKTOP_TARGET_PLATFORM
+ process.env.OPENCREATOR_KRILLINAI_TARGET_PLATFORM
+ ?? process.env.OPENCREATOR_DESKTOP_TARGET_PLATFORM
?? process.env.OPENCREATOR_CREATOR_RUNTIME_PLATFORM
?? process.platform
);
const targetArch = normalizeArch(
- process.env.OPENCREATOR_DESKTOP_TARGET_ARCH
+ process.env.OPENCREATOR_KRILLINAI_TARGET_ARCH
+ ?? process.env.OPENCREATOR_DESKTOP_TARGET_ARCH
?? process.env.OPENCREATOR_CREATOR_RUNTIME_ARCH
?? process.arch
);
diff --git a/scripts/package-krillinai-release.mjs b/scripts/package-krillinai-release.mjs
new file mode 100644
index 00000000..8e95ec6d
--- /dev/null
+++ b/scripts/package-krillinai-release.mjs
@@ -0,0 +1,243 @@
+import { createHash } from 'node:crypto';
+import { execFileSync } from 'node:child_process';
+import {
+ appendFileSync,
+ chmodSync,
+ copyFileSync,
+ existsSync,
+ mkdirSync,
+ mkdtempSync,
+ readFileSync,
+ rmSync,
+ statSync
+} from 'node:fs';
+import { tmpdir } from 'node:os';
+import { basename, dirname, join, resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { krillinReleaseAssetNames } from '../apps/desktop/scripts/release-assets.mjs';
+
+const scriptPath = fileURLToPath(import.meta.url);
+const defaultRootDir = resolve(dirname(scriptPath), '..');
+
+export function packageKrillinRelease(options = {}) {
+ const rootDir = resolve(options.rootDir ?? defaultRootDir);
+ const platform = normalizePlatform(
+ options.platform
+ ?? process.env.OPENCREATOR_KRILLINAI_TARGET_PLATFORM
+ ?? process.platform
+ );
+ const arch = normalizeArch(
+ options.arch
+ ?? process.env.OPENCREATOR_KRILLINAI_TARGET_ARCH
+ ?? process.arch
+ );
+ const version = options.version
+ ?? process.env.OPENCREATOR_VERSION?.trim()
+ ?? JSON.parse(
+ readFileSync(join(rootDir, 'apps', 'desktop', 'package.json'), 'utf8')
+ ).version;
+ const target = `${platform}-${arch}`;
+ const buildRoot = resolve(
+ options.buildRoot
+ ?? process.env.OPENCREATOR_KRILLINAI_BUILD_OUTPUT
+ ?? join(rootDir, '.runtime', 'build', 'krillinai', target)
+ );
+ const outputDir = resolve(
+ options.outputDir
+ ?? process.env.OPENCREATOR_KRILLINAI_RELEASE_OUTPUT
+ ?? join(rootDir, '.runtime', 'release', 'krillinai')
+ );
+
+ if (options.build !== false) {
+ execFileSync(process.execPath, [join(rootDir, 'scripts', 'build-krillinai.mjs')], {
+ cwd: rootDir,
+ env: {
+ ...process.env,
+ OPENCREATOR_VERSION: version,
+ OPENCREATOR_KRILLINAI_TARGET_PLATFORM: platform,
+ OPENCREATOR_KRILLINAI_TARGET_ARCH: arch,
+ OPENCREATOR_KRILLINAI_BUILD_OUTPUT: buildRoot
+ },
+ stdio: 'inherit'
+ });
+ }
+
+ const manifest = readBuildManifest(buildRoot, version, platform, arch);
+ const assetNames = krillinReleaseAssetNames(version, platform, arch);
+ const specifications = [
+ { assetName: assetNames[0], binaryName: 'krillinai-server' },
+ { assetName: assetNames[1], binaryName: 'krillinai-cli' }
+ ];
+ const stagingRoot = mkdtempSync(join(tmpdir(), 'krillinai-release-'));
+ mkdirSync(outputDir, { recursive: true });
+
+ try {
+ const assets = specifications.map(specification => {
+ const binary = manifest.binaries[specification.binaryName];
+ const source = resolve(buildRoot, binary.path);
+ if (!existsSync(source) || !statSync(source).isFile()) {
+ throw new Error(`KrillinAI release binary is missing: ${source}`);
+ }
+ if (hashFile(source) !== binary.sha256) {
+ throw new Error(`KrillinAI release binary hash mismatch: ${source}`);
+ }
+
+ const packageName = stripArchiveExtension(specification.assetName);
+ const packageRoot = join(stagingRoot, packageName);
+ const executableSuffix = platform === 'win32' ? '.exe' : '';
+ const executableName = `${specification.binaryName}${executableSuffix}`;
+ mkdirSync(join(packageRoot, 'config'), { recursive: true });
+ copyFileSync(source, join(packageRoot, executableName));
+ if (platform !== 'win32') {
+ chmodSync(join(packageRoot, executableName), 0o755);
+ }
+ copyRequiredFile(
+ join(rootDir, 'runtime', 'krillinai', 'config', 'config-example.toml'),
+ join(packageRoot, 'config', 'config-example.toml')
+ );
+ copyRequiredFile(
+ join(rootDir, 'runtime', 'krillinai', 'config', 'subtitle-style-default.json'),
+ join(packageRoot, 'config', 'subtitle-style-default.json')
+ );
+ copyRequiredFile(
+ join(rootDir, 'runtime', 'krillinai', 'LICENSE'),
+ join(packageRoot, 'LICENSE')
+ );
+
+ const archivePath = join(outputDir, specification.assetName);
+ rmSync(archivePath, { force: true });
+ createArchive({
+ archivePath,
+ packageName,
+ stagingRoot,
+ windowsZip: platform === 'win32'
+ });
+ if (!existsSync(archivePath) || statSync(archivePath).size === 0) {
+ throw new Error(`KrillinAI release archive was not created: ${archivePath}`);
+ }
+ return archivePath;
+ });
+
+ if (process.env.GITHUB_ENV) {
+ appendFileSync(
+ process.env.GITHUB_ENV,
+ `OPENCREATOR_KRILLINAI_RELEASE_ASSETS=${outputDir}\n`
+ );
+ }
+ return {
+ version,
+ platform,
+ arch,
+ outputDir,
+ assets: assets.map(path => ({
+ path,
+ name: basename(path),
+ bytes: statSync(path).size,
+ sha256: hashFile(path)
+ }))
+ };
+ } finally {
+ rmSync(stagingRoot, { recursive: true, force: true });
+ }
+}
+
+function readBuildManifest(buildRoot, version, platform, arch) {
+ const path = join(buildRoot, 'manifest.json');
+ if (!existsSync(path)) {
+ throw new Error(`KrillinAI build manifest is missing: ${path}`);
+ }
+ const manifest = JSON.parse(readFileSync(path, 'utf8'));
+ if (
+ manifest.version !== 1
+ || manifest.component !== 'opencreator-krillinai'
+ || manifest.componentVersion !== version
+ || manifest.platform !== platform
+ || manifest.arch !== arch
+ || manifest.buildVcs !== false
+ ) {
+ throw new Error('KrillinAI build manifest does not match the release target');
+ }
+ for (const name of ['krillinai-server', 'krillinai-cli']) {
+ const binary = manifest.binaries?.[name];
+ if (
+ typeof binary?.path !== 'string'
+ || !/^[a-f0-9]{64}$/i.test(binary.sha256 ?? '')
+ ) {
+ throw new Error(`KrillinAI build manifest is missing ${name}`);
+ }
+ }
+ return manifest;
+}
+
+function createArchive({ archivePath, packageName, stagingRoot, windowsZip }) {
+ if (!windowsZip) {
+ execFileSync('tar', ['-czf', archivePath, '-C', stagingRoot, packageName], {
+ stdio: 'inherit'
+ });
+ return;
+ }
+ if (process.platform === 'win32') {
+ execFileSync('powershell.exe', [
+ '-NoProfile',
+ '-NonInteractive',
+ '-Command',
+ 'Compress-Archive -LiteralPath $env:KRILLIN_PACKAGE_SOURCE '
+ + '-DestinationPath $env:KRILLIN_PACKAGE_ARCHIVE '
+ + '-CompressionLevel Optimal -Force'
+ ], {
+ env: {
+ ...process.env,
+ KRILLIN_PACKAGE_SOURCE: join(stagingRoot, packageName),
+ KRILLIN_PACKAGE_ARCHIVE: archivePath
+ },
+ stdio: 'inherit'
+ });
+ return;
+ }
+ execFileSync('zip', ['-q', '-r', archivePath, packageName], {
+ cwd: stagingRoot,
+ stdio: 'inherit'
+ });
+}
+
+function copyRequiredFile(source, destination) {
+ if (!existsSync(source) || !statSync(source).isFile()) {
+ throw new Error(`KrillinAI release resource is missing: ${source}`);
+ }
+ copyFileSync(source, destination);
+}
+
+function stripArchiveExtension(name) {
+ return name.endsWith('.tar.gz')
+ ? name.slice(0, -'.tar.gz'.length)
+ : name.slice(0, -'.zip'.length);
+}
+
+function hashFile(path) {
+ return createHash('sha256').update(readFileSync(path)).digest('hex');
+}
+
+function normalizePlatform(value) {
+ if (value === 'mac') return 'darwin';
+ if (value === 'win' || value === 'windows') return 'win32';
+ if (['darwin', 'win32', 'linux'].includes(value)) return value;
+ throw new Error(`Unsupported KrillinAI release platform: ${value}`);
+}
+
+function normalizeArch(value) {
+ if (value === 'amd64') return 'x64';
+ if (['x64', 'arm64'].includes(value)) return value;
+ throw new Error(`Unsupported KrillinAI release architecture: ${value}`);
+}
+
+const invokedDirectly = process.argv[1] !== undefined
+ && resolve(process.argv[1]) === scriptPath;
+
+if (invokedDirectly) {
+ try {
+ process.stdout.write(`${JSON.stringify(packageKrillinRelease())}\n`);
+ } catch (error) {
+ process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
+ process.exitCode = 1;
+ }
+}