mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-05 15:38:46 +08:00
change github-ci-build script
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
import childProcess from 'node:child_process'
|
||||
import { osPlatformToBuildCommandMap, currentOsPlatform } from '../vars/os.mjs'
|
||||
|
||||
export default function buildUiOnCurrentPlatform() {
|
||||
try {
|
||||
const uiBuildProcess = childProcess.spawnSync(
|
||||
`pnpm run build:${osPlatformToBuildCommandMap[currentOsPlatform]}`,
|
||||
{
|
||||
stdio: ['inherit', 'inherit', 'inherit'],
|
||||
shell: true
|
||||
}
|
||||
)
|
||||
if (uiBuildProcess.error) {
|
||||
throw uiBuildProcess.error
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('error encounter when build ui:')
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import builder from 'electron-builder'
|
||||
import yaml from 'js-yaml'
|
||||
import url from 'node:url'
|
||||
import path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import { buildTargetListMapByPlatform, osPlatformToBuildCommandMap } from '../vars/os.mjs'
|
||||
|
||||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
||||
|
||||
const getBuilderConfig = () => {
|
||||
return yaml.load(fs.readFileSync(path.join(__dirname, '../../electron-builder.yml'), 'utf8'))
|
||||
}
|
||||
|
||||
export default async function makeDistForCurrentPlatform() {
|
||||
const buildTargets = buildTargetListMapByPlatform[process.platform]
|
||||
const platformKeyForBuildParameter = osPlatformToBuildCommandMap[process.platform]
|
||||
if (!buildTargets?.length || !platformKeyForBuildParameter) {
|
||||
console.log('Cannot build for current platform')
|
||||
process.exit(1)
|
||||
}
|
||||
const buildParameter = {
|
||||
config: getBuilderConfig()
|
||||
}
|
||||
buildParameter[platformKeyForBuildParameter] = buildTargets.map((it) => `${it}:${process.arch}`)
|
||||
|
||||
return await builder.build(buildParameter)
|
||||
}
|
||||
Reference in New Issue
Block a user