📧✨ Beautiful email. For everyone.
feat: sign and notarize macOS releases (#15)
Paul Koeck2a22ce443443
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 0fdc547..cff0974 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -48,10 +48,26 @@ jobs:expected: 4metadataSuffix: -macruns-on: ${{ matrix.runner }}- env:- CSC_IDENTITY_AUTO_DISCOVERY: 'false'steps:- uses: actions/checkout@v7+ - name: Prepare macOS signing and notarization+ if: runner.os == 'macOS'+ shell: bash+ env:+ MAC_CSC_LINK: ${{ secrets.MAC_CSC_LINK }}+ MAC_CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }}+ APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}+ APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}+ APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}+ run: |+ for name in MAC_CSC_LINK MAC_CSC_KEY_PASSWORD APPLE_API_KEY APPLE_API_KEY_ID APPLE_API_ISSUER; do+ if [ -z "${!name}" ]; then+ echo "::error::Missing macOS release credential: $name. See docs/releasing.md."+ exit 1+ fi+ done+ umask 077+ printf '%s\n' "$APPLE_API_KEY" > "$RUNNER_TEMP/AuthKey.p8"- uses: actions/setup-node@v7with:node-version: '24'@@ -69,7 +85,42 @@ jobs:- name: Build desktop apprun: pnpm build- name: Package desktop app+ if: runner.os != 'macOS'+ env:+ CSC_IDENTITY_AUTO_DISCOVERY: 'false'+ run: pnpm --filter @inlark/desktop exec electron-builder ${{ matrix.args }} --publish never+ - name: Sign, notarize and package macOS app+ if: runner.os == 'macOS'+ env:+ CSC_IDENTITY_AUTO_DISCOVERY: 'true'+ CSC_LINK: ${{ secrets.MAC_CSC_LINK }}+ CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }}+ APPLE_API_KEY: ${{ runner.temp }}/AuthKey.p8+ APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}+ APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}run: pnpm --filter @inlark/desktop exec electron-builder ${{ matrix.args }} --publish never+ - name: Verify signed and notarized macOS ZIPs+ if: runner.os == 'macOS'+ shell: bash+ run: |+ version="${GITHUB_REF_NAME#v}"+ for arch in x64 arm64; do+ archive="apps/desktop/release/Inlark-${version}-${arch}.zip"+ test -f "$archive"+ test -f "${archive}.blockmap"+ test -f "apps/desktop/release/Inlark-${version}-${arch}.dmg"+ destination="$RUNNER_TEMP/verify-macos-$arch"+ ditto -x -k "$archive" "$destination"+ app="$destination/Inlark.app"+ codesign --verify --deep --strict --verbose=2 "$app"+ codesign --display --verbose=4 "$app" 2>&1 | grep -F 'Authority=Developer ID Application:'+ xcrun stapler validate "$app"+ spctl --assess --type execute --verbose=2 "$app"+ done+ - name: Remove macOS notarization key+ if: always() && runner.os == 'macOS'+ shell: bash+ run: rm -f "$RUNNER_TEMP/AuthKey.p8"- name: Collect installersshell: bashrun: |@@ -157,6 +208,12 @@ jobs:for suffix in '' -mac -linux; dotest -f "release-assets/${channel}${suffix}.yml"done+ for arch in x64 arm64; do+ archive="Inlark-${RELEASE_TAG#v}-${arch}.zip"+ test -f "release-assets/$archive"+ test -f "release-assets/${archive}.blockmap"+ grep -F -- "$archive" "release-assets/${channel}-mac.yml"+ doneoptions=()if [[ "$RELEASE_TAG" == *-* ]]; thenoptions+=(--prerelease)diff --git a/README.md b/README.mdindex 802796b..2a6820a 100644--- a/README.md+++ b/README.md@@ -65,22 +65,19 @@ Packaged builds check for updates in the background. When an update downloads su| macOS | DMG or ZIP, for both Apple Silicon and Intel || Linux | AppImage, `.deb` or `.rpm` (x64), or [Nix](#nix-and-nixos) |-The Windows and macOS builds aren't signed yet, so your system will ask you to confirm before the first launch. That's expected.-Automatic updates on macOS require code signing; until signed builds are available, use the download link shown in Inlark when a new release is available.-### Nix and NixOSInstall from the flake:```sh-nix profile install 'github:inlark/inlark/v0.1.0#inlark'+nix profile install 'github:inlark/inlark#inlark'```Or enable the NixOS module in your flake configuration:```nix{- inputs.inlark.url = "github:inlark/inlark/v0.1.0";+ inputs.inlark.url = "github:inlark/inlark";outputs = { nixpkgs, inlark, ... }: {nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {@@ -94,7 +91,9 @@ Or enable the NixOS module in your flake configuration:}```-The package includes the desktop entry, icon and `mailto:` handler, for x86_64 and aarch64 Linux. Leave out `/v0.1.0` to follow the default branch.+The package includes the desktop entry, icon and `mailto:` handler, for x86_64 and aarch64 Linux. These examples follow the latest code on the default branch.++To update a profile installation, run `nix profile upgrade inlark`. For NixOS, run `nix flake update inlark` from your system configuration directory, then `sudo nixos-rebuild switch --flake .#my-host` (replace `my-host` with your host name). Nix keeps the installed revision until you update it; removing the release tag does not enable automatic updates.## Connect an account@@ -134,8 +133,6 @@ pnpm test:deb # Debian packaging smoke test (Podman)The Nix build is pinned by `flake.lock`, `pnpm-lock.yaml` and the dependency hash in `nix/package.nix`. After changing dependencies, replace that hash with the one Nix reports.-Pushing a `v<version>` tag runs the [release workflow](.github/workflows/release.yml), which builds every platform, checks the Nix flake and publishes a GitHub Release. The tag is the source of truth: CI sets the desktop package version from it before building, so no manual `package.json` version update is needed.-To smoke-test the Nix package without opening a window:```shdiff --git a/apps/desktop/electron-builder.yml b/apps/desktop/electron-builder.ymlindex 81023dd..7153320 100644--- a/apps/desktop/electron-builder.yml+++ b/apps/desktop/electron-builder.yml@@ -29,8 +29,14 @@ protocols:- name: Emailschemes: [mailto]mac:+ target:+ - dmg+ - zipicon: resources/icon.pngartifactName: 'Inlark-${version}-${arch}.${ext}'+ forceCodeSigning: true+ hardenedRuntime: true+ notarize: truewin:icon: resources/icon.pngartifactName: 'Inlark-${version}-${arch}-setup.${ext}'diff --git a/apps/marketing/src/components/download/Download.tsx b/apps/marketing/src/components/download/Download.tsxindex b738148..fa1bcb4 100644--- a/apps/marketing/src/components/download/Download.tsx+++ b/apps/marketing/src/components/download/Download.tsx@@ -274,7 +274,7 @@ export function DownloadPage({ initial }: { initial: Release }) {id="install"className="mx-auto max-w-6xl -scroll-mt-20 px-5 pt-28 sm:-scroll-mt-24 sm:px-8 sm:pt-36">- <Steps key={download.build.id} download={download} version={release.version} />+ <Steps key={download.build.id} download={download} /></section>)}diff --git a/apps/marketing/src/components/download/Steps.tsx b/apps/marketing/src/components/download/Steps.tsxindex 5dbf02c..2b2c482 100644--- a/apps/marketing/src/components/download/Steps.tsx+++ b/apps/marketing/src/components/download/Steps.tsx@@ -25,7 +25,7 @@ const connect: Step = {visual: <ConnectVisual />,}-function steps({ build, file }: Download, version: string): Step[] {+function steps({ build, file }: Download): Step[] {switch (build.id) {case 'mac-arm64':case 'mac-x64':@@ -133,10 +133,10 @@ function steps({ build, file }: Download, version: string): Step[] {return [{title: 'Install from the flake',- body: 'Adds the launcher, desktop entry, icon and mailto: handler to your profile. Needs flakes enabled.',+ body: 'Installs the latest code from the default branch, with a launcher, desktop entry, icon and mailto: handler. Needs flakes enabled.',visual: (<CodeBlock- code={`nix profile install 'github:inlark/inlark/v${version}#inlark'`}+ code="nix profile install 'github:inlark/inlark#inlark'"title="Terminal"className="h-full"/>@@ -146,7 +146,8 @@ function steps({ build, file }: Download, version: string): Step[] {title: 'Open Inlark',body: (<>- Find it in your app menu, or run <Path>inlark</Path>.+ Find it in your app menu, or run <Path>inlark</Path>. To get updates, run{' '}+ <Path>nix profile upgrade inlark</Path>.</>),visual: <LauncherVisual />,@@ -157,10 +158,12 @@ function steps({ build, file }: Download, version: string): Step[] {return [{title: 'Add the flake',- body: 'Add Inlark as an input, then enable its module in your system configuration.',+ body: 'Follow the latest code from the default branch by adding Inlark as an input, then enable its module in your system configuration.',visual: (<CodeBlock- code={`# flake.nix\ninputs.inlark.url = "github:inlark/inlark/v${version}";\n\n# modules of your nixosSystem\ninlark.nixosModules.default\n{ programs.inlark.enable = true; }`}+ code={+ '# flake.nix\ninputs.inlark.url = "github:inlark/inlark";\n\n# modules of your nixosSystem\ninlark.nixosModules.default\n{ programs.inlark.enable = true; }'+ }shell={false}title="Configuration"className="h-full"@@ -169,7 +172,13 @@ function steps({ build, file }: Download, version: string): Step[] {},{title: 'Switch to it',- body: 'Rebuild your system and Inlark appears in your app menu.',+ body: (+ <>+ Rebuild your system and Inlark appears in your app menu. For updates, run{' '}+ <Path>nix flake update inlark</Path> in your system configuration directory, then+ rebuild.+ </>+ ),visual: (<CodeBlock code="sudo nixos-rebuild switch" title="Terminal" className="h-full" />),@@ -179,8 +188,8 @@ function steps({ build, file }: Download, version: string): Step[] {}}-export function Steps({ download, version }: { download: Download; version: string }) {- const list = steps(download, version)+export function Steps({ download }: { download: Download }) {+ const list = steps(download)const os = download.build.osreturn (<div>