Skip to content

Commit

Permalink
Add notarization
Browse files Browse the repository at this point in the history
  • Loading branch information
SRichner committed Feb 20, 2024
1 parent 617697e commit 73cd969
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 5 deletions.
34 changes: 34 additions & 0 deletions src/electron/build/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { notarize } = require('@electron/notarize');

module.exports = async (context) => {
if (process.platform !== 'darwin') {
return;
}
console.info('AfterSign hook triggered. Starting notarization step.');
if (!process.env.CI) {
console.warn('Skipping notarizing, not running in CI.');
return;
}
if (!('APPLE_ID' in process.env && 'APPLE_APP_SPECIFIC_PASSWORD' in process.env)) {
console.warn(
'Skipping notarizing step. APPLE_ID and APPLE_APP_SPECIFIC_PASSWORD env variables must be set.'
);
return;
}

const appName = context.packager.appInfo.productFilename;
const { appOutDir } = context;
try {
await notarize({
tool: 'notarytool',
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD,
teamId: process.env.APPLE_TEAM_ID
});
} catch (error) {
console.error(error);
}

console.log(`Done notarizing.`);
};
40 changes: 35 additions & 5 deletions src/electron/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"url": "https://github.com/HASEL-UZH/PersonalAnalytics"
},
"devDependencies": {
"@electron/notarize": "^2.3.0",
"@rushstack/eslint-patch": "^1.7.2",
"@types/node-schedule": "^2.1.6",
"@typescript-eslint/eslint-plugin": "^6.20.0",
Expand Down

0 comments on commit 73cd969

Please sign in to comment.