mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-26 13:19:34 +07:00
🔧 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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
// 写回文件
|
||||
|
||||
Reference in New Issue
Block a user