2017-05-01 17:01:14 +03:00
|
|
|
#!/usr/bin/env node
|
2022-06-02 21:15:30 +03:00
|
|
|
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
2017-05-01 17:01:14 +03:00
|
|
|
const builder = require('electron-builder').build
|
|
|
|
const vars = require('./vars')
|
|
|
|
|
2019-08-15 16:17:15 +03:00
|
|
|
const isTag = (process.env.GITHUB_REF || '').startsWith('refs/tags/')
|
2019-07-04 15:08:47 +03:00
|
|
|
|
2020-12-24 20:18:07 +03:00
|
|
|
process.env.ARCH = process.env.ARCH || process.arch
|
|
|
|
|
2021-05-25 00:30:05 +03:00
|
|
|
if (process.env.GITHUB_HEAD_REF) {
|
|
|
|
delete process.env.CSC_LINK
|
|
|
|
delete process.env.CSC_KEY_PASSWORD
|
|
|
|
process.env.CSC_IDENTITY_AUTO_DISCOVERY = 'false'
|
|
|
|
}
|
|
|
|
|
2017-05-01 17:01:14 +03:00
|
|
|
builder({
|
2019-07-04 15:08:47 +03:00
|
|
|
dir: true,
|
2020-05-07 14:00:42 +03:00
|
|
|
mac: ['pkg', 'zip'],
|
2022-10-26 10:45:12 +03:00
|
|
|
x64: process.env.ARCH === 'x86_64',
|
2020-12-24 20:18:07 +03:00
|
|
|
arm64: process.env.ARCH === 'arm64',
|
2019-07-04 15:08:47 +03:00
|
|
|
config: {
|
|
|
|
extraMetadata: {
|
|
|
|
version: vars.version,
|
|
|
|
},
|
2021-06-19 21:10:34 +03:00
|
|
|
mac: {
|
|
|
|
identity: !process.env.CI || process.env.CSC_LINK ? undefined : null,
|
|
|
|
},
|
2021-01-27 02:26:48 +03:00
|
|
|
npmRebuild: process.env.ARCH !== 'arm64',
|
2022-10-01 16:40:50 +03:00
|
|
|
publish: process.env.KEYGEN_TOKEN ? [
|
|
|
|
vars.keygenConfig,
|
|
|
|
{
|
|
|
|
provider: 'github',
|
|
|
|
channel: `latest-${process.env.ARCH}`,
|
|
|
|
},
|
|
|
|
] : undefined,
|
2018-08-09 22:47:38 +03:00
|
|
|
},
|
2022-10-01 14:04:55 +03:00
|
|
|
publish: process.env.KEYGEN_TOKEN ? isTag ? 'always' : 'onTagOrDraft' : 'never',
|
2020-05-07 18:37:39 +03:00
|
|
|
}).catch(e => {
|
|
|
|
console.error(e)
|
|
|
|
process.exit(1)
|
|
|
|
})
|