🔧 build: add canary desktop release workflow (#12286)

🔧 build: add canary desktop release workflow and channel support

Add automated canary build pipeline triggered by build/fix/style commits
on canary branch, with concurrency control to cancel stale builds.
This commit is contained in:
Innei
2026-02-13 00:37:03 +08:00
committed by GitHub
parent bbbe3a8d09
commit c11d6de7db
4 changed files with 419 additions and 21 deletions

View File

@@ -3,7 +3,7 @@ import path from 'node:path';
import fs from 'fs-extra';
type ReleaseChannel = 'stable' | 'beta' | 'nightly';
type ReleaseChannel = 'stable' | 'beta' | 'nightly' | 'canary';
const rootDir = path.resolve(__dirname, '../..');
const desktopDir = path.join(rootDir, 'apps/desktop');
@@ -74,7 +74,7 @@ const restoreFile = async (filePath: string, content?: Buffer) => {
};
const validateChannel = (channel: string): channel is ReleaseChannel =>
channel === 'stable' || channel === 'beta' || channel === 'nightly';
channel === 'stable' || channel === 'beta' || channel === 'nightly' || channel === 'canary';
const runCommand = (command: string, env?: Record<string, string | undefined>) => {
execSync(command, {
@@ -89,7 +89,7 @@ const main = async () => {
if (!validateChannel(channel)) {
console.error(
'Missing or invalid channel. Usage: npm run desktop:build-channel -- <stable|beta|nightly> [version] [--keep-changes]',
'Missing or invalid channel. Usage: npm run desktop:build-channel -- <stable|beta|nightly|canary> [version] [--keep-changes]',
);
process.exit(1);
}

View File

@@ -2,7 +2,7 @@ import path from 'node:path';
import fs from 'fs-extra';
type ReleaseType = 'stable' | 'beta' | 'nightly';
type ReleaseType = 'stable' | 'beta' | 'nightly' | 'canary';
// 获取脚本的命令行参数
const version = process.argv[2];
@@ -11,14 +11,14 @@ const releaseType = process.argv[3] as ReleaseType;
// 验证参数
if (!version || !releaseType) {
console.error(
'Missing parameters. Usage: bun run setDesktopVersion.ts <version> <stable|beta|nightly>',
'Missing parameters. Usage: bun run setDesktopVersion.ts <version> <stable|beta|nightly|canary>',
);
process.exit(1);
}
if (!['stable', 'beta', 'nightly'].includes(releaseType)) {
if (!['stable', 'beta', 'nightly', 'canary'].includes(releaseType)) {
console.error(
`Invalid release type: ${releaseType}. Must be one of 'stable', 'beta', 'nightly'.`,
`Invalid release type: ${releaseType}. Must be one of 'stable', 'beta', 'nightly', 'canary'.`,
);
process.exit(1);
}
@@ -95,6 +95,13 @@ function updatePackageJson() {
updateAppIcon('nightly');
break;
}
case 'canary': {
packageJson.productName = 'LobeHub-Canary';
packageJson.name = 'lobehub-desktop-canary';
console.log('🐤 Setting as Canary version.');
updateAppIcon('nightly');
break;
}
}
// 写回文件