1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-27 20:43:01 +03:00
tabby/build/mac/afterSignHook.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-06-27 11:54:18 +03:00
// See: https://medium.com/@TwitterArchiveEraser/notarize-electron-apps-7a5f988406db
const fs = require('fs')
const path = require('path')
const notarizer = require('electron-notarize')
module.exports = async function (params) {
// notarize the app on Mac OS only.
2020-05-04 15:19:40 +03:00
if (process.platform !== 'darwin' || !process.env.GITHUB_REF || !process.env.GITHUB_REF.startsWith('refs/tags/')) {
2019-06-27 11:54:18 +03:00
return
}
console.log('afterSign hook triggered', params)
2021-06-30 00:57:04 +03:00
let appId = 'org.tabby'
2019-06-27 11:54:18 +03:00
2020-05-07 18:37:39 +03:00
let appPath = path.join(params.appOutDir, params._pathOverride || `${params.packager.appInfo.productFilename}.app`)
2019-06-27 11:54:18 +03:00
if (!fs.existsSync(appPath)) {
throw new Error(`Cannot find application at: ${appPath}`)
}
console.log(`Notarizing ${appId} found at ${appPath}`)
try {
await notarizer.notarize({
appBundleId: appId,
appPath: appPath,
appleId: process.env.APPSTORE_USERNAME,
appleIdPassword: process.env.APPSTORE_PASSWORD,
})
} catch (error) {
console.error(error)
}
console.log(`Done notarizing ${appId}`)
}