chore(ci): use electron-builder default to have notarization tool

This commit is contained in:
Neko Ayaka
2026-03-02 23:20:24 +08:00
parent f4dc07c77f
commit dd8c2d960c
2 changed files with 28 additions and 30 deletions
+3 -3
View File
@@ -147,9 +147,9 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_CONTENT: ${{ secrets.CSC_CONTENT }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_DEVELOPER_TEAM_ID: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }}
APPLE_DEVELOPER_APPLE_ID: ${{ secrets.APPLE_DEVELOPER_APPLE_ID }}
APPLE_DEVELOPER_APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_DEVELOPER_APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_DEVELOPER_APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_DEVELOPER_APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }}
- name: Build (Linux Only) # Linux
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
@@ -3,9 +3,7 @@
import type { Configuration } from 'electron-builder'
import { execSync } from 'node:child_process'
import { env } from 'node:process'
import { notarize } from '@electron/notarize'
import { isMacOS } from 'std-env'
function hasXcode26OrAbove() {
@@ -44,30 +42,30 @@ export default {
output: 'dist',
buildResources: 'build',
},
// For self-publishing, testing, and distribution after modified the code without access to
// an Apple Developer account, comment and uncomment the following 4 lines.
// Later on when you obtained one, you can set up the necessary certificates and provisioning
// profiles to enable these security features.
//
// https://www.bigbinary.com/blog/code-sign-notorize-mac-desktop-app
// https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
afterSign: async (context) => {
const { electronPlatformName, appOutDir } = context
if (electronPlatformName !== 'darwin')
return
if (env.CI !== 'true') {
console.warn('Skipping notarizing step. Packaging is not running in CI')
return
}
// // For self-publishing, testing, and distribution after modified the code without access to
// // an Apple Developer account, comment and uncomment the following lines.
// // Later on when you obtained one, you can set up the necessary certificates and provisioning
// // profiles to enable these security features.
// //
// // https://www.bigbinary.com/blog/code-sign-notorize-mac-desktop-app
// // https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
// afterSign: async (context) => {
// const { electronPlatformName, appOutDir } = context
// if (electronPlatformName !== 'darwin')
// return
// if (env.CI !== 'true') {
// console.warn('Skipping notarizing step. Packaging is not running in CI')
// return
// }
const appName = context.packager.appInfo.productFilename
await notarize({
appPath: `${appOutDir}/${appName}.app`,
teamId: env.APPLE_DEVELOPER_TEAM_ID!,
appleId: env.APPLE_DEVELOPER_APPLE_ID!,
appleIdPassword: env.APPLE_DEVELOPER_APPLE_APP_SPECIFIC_PASSWORD!,
})
},
// const appName = context.packager.appInfo.productFilename
// await notarize({
// appPath: `${appOutDir}/${appName}.app`,
// teamId: env.APPLE_DEVELOPER_TEAM_ID!,
// appleId: env.APPLE_DEVELOPER_APPLE_ID!,
// appleIdPassword: env.APPLE_DEVELOPER_APPLE_APP_SPECIFIC_PASSWORD!,
// })
// },
files: [
'out/**',
'resources/**',
@@ -119,14 +117,14 @@ export default {
NSCameraUsageDescription: 'AIRI requires camera access for vision understanding',
},
],
// We have customized the notarization step in the `afterSign` hook.
notarize: false,
// For self-publishing, testing, and distribution after modified the code without access to
// an Apple Developer account, comment and uncomment the following 4 lines.
// Later on when you obtained one, you can set up the necessary certificates and provisioning
// profiles to enable these security features.
// hardenedRuntime: false,
hardenedRuntime: true,
// notarize: false,
notarize: true,
executableName: 'airi',
icon: useIconFormattedMacAppIcon ? 'icon.icon' : 'icon.icns',
},