tabby/scripts/build-macos.js

38 lines
1014 B
JavaScript
Raw Normal View History

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