2017-05-01 14:01:14 +00:00
|
|
|
#!/usr/bin/env node
|
2022-06-02 18:15:30 +00:00
|
|
|
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
2023-02-26 19:42:31 +00:00
|
|
|
import { build as builder } from 'electron-builder'
|
|
|
|
import * as vars from './vars.mjs'
|
2017-05-01 14:01:14 +00:00
|
|
|
|
2019-08-15 13:17:15 +00:00
|
|
|
const isTag = (process.env.GITHUB_REF || '').startsWith('refs/tags/')
|
2019-07-04 12:08:47 +00:00
|
|
|
|
2020-12-24 17:18:07 +00:00
|
|
|
process.env.ARCH = process.env.ARCH || process.arch
|
|
|
|
|
2021-05-24 21:30:05 +00: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'
|
|
|
|
}
|
|
|
|
|
2023-07-18 22:03:58 +00:00
|
|
|
process.env.APPLE_ID ??= process.env.APPSTORE_USERNAME
|
|
|
|
process.env.APPLE_APP_SPECIFIC_PASSWORD ??= process.env.APPSTORE_PASSWORD
|
|
|
|
|
2017-05-01 14:01:14 +00:00
|
|
|
builder({
|
2019-07-04 12:08:47 +00:00
|
|
|
dir: true,
|
2020-05-07 11:00:42 +00:00
|
|
|
mac: ['pkg', 'zip'],
|
2022-10-26 07:45:12 +00:00
|
|
|
x64: process.env.ARCH === 'x86_64',
|
2020-12-24 17:18:07 +00:00
|
|
|
arm64: process.env.ARCH === 'arm64',
|
2019-07-04 12:08:47 +00:00
|
|
|
config: {
|
|
|
|
extraMetadata: {
|
|
|
|
version: vars.version,
|
|
|
|
},
|
2021-06-19 18:10:34 +00:00
|
|
|
mac: {
|
|
|
|
identity: !process.env.CI || process.env.CSC_LINK ? undefined : null,
|
2023-07-18 22:03:58 +00:00
|
|
|
notarize: process.env.APPLE_TEAM_ID ? {
|
|
|
|
appBundleId: 'org.tabby',
|
|
|
|
teamId: process.env.APPLE_TEAM_ID,
|
|
|
|
} : false,
|
|
|
|
},
|
2021-01-26 23:26:48 +00:00
|
|
|
npmRebuild: process.env.ARCH !== 'arm64',
|
2022-10-01 13:40:50 +00:00
|
|
|
publish: process.env.KEYGEN_TOKEN ? [
|
|
|
|
vars.keygenConfig,
|
|
|
|
{
|
|
|
|
provider: 'github',
|
|
|
|
channel: `latest-${process.env.ARCH}`,
|
|
|
|
},
|
|
|
|
] : undefined,
|
2018-08-09 19:47:38 +00:00
|
|
|
},
|
2022-10-01 11:04:55 +00:00
|
|
|
publish: process.env.KEYGEN_TOKEN ? isTag ? 'always' : 'onTagOrDraft' : 'never',
|
2020-05-07 15:37:39 +00:00
|
|
|
}).catch(e => {
|
|
|
|
console.error(e)
|
|
|
|
process.exit(1)
|
|
|
|
})
|