chore: desktop workflow
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
import { Command } from './Command'
|
||||
import { publishSnap } from './publishSnap'
|
||||
import { runCommand } from './runCommand'
|
||||
import { Command } from './Command.mjs'
|
||||
import { publishSnap } from './publishSnap.mjs'
|
||||
import { runCommand } from './runCommand.mjs'
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
@@ -159,29 +159,4 @@ const BuildCommands = {
|
||||
}),
|
||||
],
|
||||
[Targets.Windows]: [Command('yarn run electron-builder --windows --x64 --ia32 --publish=never', DesktopDir)],
|
||||
}
|
||||
|
||||
;(async () => {
|
||||
try {
|
||||
const input = process.argv[2]
|
||||
let targets = input.split(',')
|
||||
|
||||
console.log('Input targets:', targets)
|
||||
|
||||
if (targets.length === 1) {
|
||||
if (TargetGroups[targets[0]]) {
|
||||
targets = TargetGroups[targets[0]]
|
||||
}
|
||||
}
|
||||
await buildTargets(targets)
|
||||
|
||||
if (input === MainstreamTargetGroup) {
|
||||
await runCommand(Command('node sums.mjs', ScriptsDir))
|
||||
await runCommand(Command('node create-draft-release.mjs', ScriptsDir))
|
||||
await publishSnap()
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
process.exitCode = 1
|
||||
}
|
||||
})()
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { Command } from './Command'
|
||||
import { runCommand } from './runCommand'
|
||||
import { DesktopDir } from './build'
|
||||
import { Command } from './Command.mjs'
|
||||
import { runCommand } from './runCommand.mjs'
|
||||
import { DesktopDir } from './build.mjs'
|
||||
|
||||
export async function publishSnap() {
|
||||
const packageJson = await fs.promises.readFile(path.join(DesktopDir, 'package.json'))
|
||||
const version = JSON.parse(packageJson).version
|
||||
await runCommand(Command(`snapcraft upload dist/standard-notes-${version}-linux-amd64.snap`, DesktopDir))
|
||||
try {
|
||||
const packageJson = await fs.promises.readFile(path.join(DesktopDir, 'package.json'))
|
||||
const version = JSON.parse(packageJson).version
|
||||
await runCommand(Command(`snapcraft upload dist/standard-notes-${version}-linux-amd64.snap`, DesktopDir))
|
||||
} catch (error) {
|
||||
console.error('Error publishing snap', error)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user