|
| 1 | +// Copyright 2022 Arduino SA |
| 2 | +// |
| 3 | +// This program is free software: you can redistribute it and/or modify |
| 4 | +// it under the terms of the GNU Affero General Public License as published |
| 5 | +// by the Free Software Foundation, either version 3 of the License, or |
| 6 | +// (at your option) any later version. |
| 7 | +// |
| 8 | +// This program is distributed in the hope that it will be useful, |
| 9 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | +// GNU Affero General Public License for more details. |
| 12 | +// |
| 13 | +// You should have received a copy of the GNU Affero General Public License |
| 14 | +// along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 15 | + |
| 16 | +const isCI = require('is-ci'); |
| 17 | +const { notarize } = require('electron-notarize'); |
| 18 | + |
| 19 | +exports.default = async function notarizing(context) { |
| 20 | + if (!isCI) { |
| 21 | + console.log('Skipping notarization: not on CI.'); |
| 22 | + return; |
| 23 | + } |
| 24 | + if (process.env.IS_FORK === 'true') { |
| 25 | + console.log('Skipping the app notarization: building from a fork.'); |
| 26 | + return; |
| 27 | + } |
| 28 | + const { electronPlatformName, appOutDir } = context; |
| 29 | + if (electronPlatformName !== 'darwin') { |
| 30 | + return; |
| 31 | + } |
| 32 | + |
| 33 | + const appName = context.packager.appInfo.productFilename; |
| 34 | + const appBundleId = context.packager.config.appId; |
| 35 | + console.log(`>>> Notarizing ${appBundleId} at ${appOutDir}/${appName}.app...`); |
| 36 | + |
| 37 | + return await notarize({ |
| 38 | + appBundleId, |
| 39 | + appPath: `${appOutDir}/${appName}.app`, |
| 40 | + appleId: process.env.AC_USERNAME, |
| 41 | + appleIdPassword: process.env.AC_PASSWORD, |
| 42 | + }); |
| 43 | +}; |
0 commit comments