Principle:777genius Agent teams ai Platform Packaging
| Knowledge Sources | |
|---|---|
| Domains | Release, Packaging |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Pattern for packaging an Electron app into platform-specific installers (dmg, exe, AppImage, deb) with code signing and macOS notarization.
Description
Platform Packaging uses electron-builder to produce platform-specific installers from the built Electron app. On macOS, the `afterSign` hook performs notarization via Apple's notarytool service, validating the app bundle ID, signing team, and API credentials.
Key aspects:
- Platform targets: macOS (.dmg), Windows (.exe), Linux (.AppImage, .deb).
- After-sign hook: The `notarizing()` function is an electron-builder `afterSign` hook that runs after code signing.
- macOS notarization: Uses `@electron/notarize` with `notarytool` to submit the app to Apple's notarization service.
- Credential validation: Validates `APPLE_API_KEY`, `APPLE_API_KEY_ID`, `APPLE_API_ISSUER`, and `APPLE_TEAM_ID` environment variables.
- Team ID check: Verifies `APPLE_TEAM_ID` matches the expected signing team ('86399583GS').
- Bundle ID: The app bundle ID is `com.agent-teams.app`.
- Platform guard: Notarization only runs on macOS (`electronPlatformName === 'darwin'`); other platforms skip the hook.
Usage
Use this principle when packaging an Electron app for distribution with code signing and notarization, especially when Apple notarization is required for macOS distribution.
Theoretical Basis
# Abstract algorithm (NOT real implementation)
async def notarizing(context):
if context.platform != 'darwin':
return # Skip on non-macOS
# Validate credentials
require_env('APPLE_API_KEY')
require_env('APPLE_API_KEY_ID')
require_env('APPLE_API_ISSUER')
assert os.environ['APPLE_TEAM_ID'] == EXPECTED_TEAM_ID
# Submit to Apple notarization
await notarize(
tool='notarytool',
app_bundle_id='com.agent-teams.app',
app_path=f'{context.appOutDir}/{appName}.app',
apple_api_key=...,
apple_api_key_id=...,
apple_api_issuer=...
)