Skip to content

Lesson 7 of 9 · 24m

Packaging and Release Pipelines That Don't Betray You

asar, installers, signing, notarization, artifacts, and the build discipline needed to produce binaries users can trust.

A desktop application is not shipped when npm run build exits zero. It is shipped when the signed artifact installs cleanly on a real machine, launches offline, preserves user data, and can be reproduced if the release machine disappears. Packaging is product engineering and supply-chain engineering at the same time.

Know what electron-builder is doing

A typical configuration starts simple:

{
  "appId": "org.sudosecurity.desktop",
  "productName": "SudoSecurity Desktop",
  "files": ["dist/**", "package.json"],
  "asar": true,
  "mac": { "category": "forums.app-category.utilities", "hardenedRuntime": true },
  "win": { "target": ["nsis"], "artifactName": "sudosecurity-${version}-setup.${ext}" },
  "linux": { "target": ["AppImage", "deb"] },
  "publish": null
}

asar archives application JavaScript into one indexed file. It is packaging, not encryption. Anyone can extract it. Do not put private keys, production secrets, or confidential algorithms in client bundles.

Signing is identity, not paperwork

Windows uses Authenticode; macOS uses Developer ID plus notarization. Users see SmartScreen or Gatekeeper when you get this wrong. The operational rules are boring: certificates live in a controlled secret store, CI signs on a hardened runner, private keys never enter repository artifacts, and release provenance is recorded. Notarization is not optional for modern macOS distribution outside the App Store.

# macOS output should show a signed, notarized, stapled app
codesign --verify --deep --strict --verbose=2 "SudoSecurity Desktop.app"
spctl --assess --type execute -vv "SudoSecurity Desktop.app"
xcrun stapler validate "SudoSecurity Desktop.app"

Reproducibility beats cleverness

Use a clean checkout, locked dependencies, explicit Node/Electron versions, and controlled environment variables. npm ci is the correct install command in release CI. Record commit SHA, Electron version, builder version, signing identity, artifact hashes, and build machine identity in the release manifest. If you cannot answer "what exactly is in this installer?" you cannot respond to a supply-chain incident.

Installers are hostile-edge-case machines

Windows installer upgrades must handle running processes and per-user versus machine-wide installs. macOS must preserve or migrate app support data. Linux packages must not assume every user has the same desktop environment. Test upgrade paths, not only fresh installs: old version -> new version, interrupted install, downgraded install blocked deliberately, and uninstall preserving or removing data according to policy.

Field notes

  • Ship release artifacts with SHA-256 checksums and keep them immutable after publication.
  • Never sign locally built artifacts as an emergency habit; emergency exceptions become release culture.
  • Inspect the final package for .env, source maps with secrets, test fixtures, and unused native binaries.
  • A delta or smaller download is worthless if the base installer cannot install cleanly; test the boring path first.

Was this lesson helpful?

Sign in to rate