GitHub
Releasing

Releasing Ledgeline

Tagging vX.Y.Z builds, signs, notarizes and publishes the macOS DMGs, and builds the Windows MSIs. .github/workflows/release.yml is the whole pipeline. This document covers what cannot live in a comment there: the one-time Apple setup, and what to do when notarization fails.

What ships

Two DMGs and four MSIs, attached to one GitHub Release with one SHA256SUMS.txt covering all six, plus five crates on crates.io (see Publishing to crates.io):

InstallerAppBuilt by
Ledgeline-X.Y.Z-arm64.dmgLedgeline.apppackage leg, flake.nix macApp
LedgelineInvoicer-X.Y.Z-arm64.dmgLedgeline Invoicer.apppackage leg, flake.nix invoicerMacApp
Ledgeline-X.Y.Z-windows-x64.msiledgeline.exewindows leg (x64), assets/windows/ledgeline.wxs
Ledgeline-X.Y.Z-windows-arm64.msiledgeline.exewindows leg (arm64), the same
LedgelineInvoicer-X.Y.Z-windows-x64.msiledgeline-invoicer.exewindows leg (x64), assets/windows/ledgeline-invoicer.wxs
LedgelineInvoicer-X.Y.Z-windows-arm64.msiledgeline-invoicer.exewindows leg (arm64), the same

The release job fails unless all six, and their checksums, are there. See Windows for the MSIs.

The DMGs are Apple Silicon only. Intel Macs were dropped in 0.4.0 (see No Intel build). The same mkMacApp assembles both apps, and they are signed with the same Developer ID certificate and notary key. Nothing about signing is per-app. The release job fails unless both DMGs, and their checksums, are there.

Each app is:

The matrix

The matrix is the only place the app and the architecture are named:

runs-on: macos-15            # EVERY leg; pinned, as in ci.yml
matrix:
  include:
    - {app: ledgeline, appName: Ledgeline, exe: ledgeline, flakeAttr: macApp,
       dmgPrefix: Ledgeline, arch: arm64,  nixSystem: aarch64-darwin}
    - {app: invoicer, appName: Ledgeline Invoicer, exe: ledgeline-invoicer,
       flakeAttr: invoicerMacApp, dmgPrefix: LedgelineInvoicer,
       arch: arm64, nixSystem: aarch64-darwin}

Everything downstream reads the matrix entry. The job builds .#packages.<nixSystem>.<flakeAttr> and asserts lipo -archs on every Mach-O in the bundle, so a DMG is always the architecture its name claims.

No Intel build

0.3.x shipped an x86_64 Ledgeline DMG, built on an Apple Silicon runner under Rosetta (no Intel runner can install Nix) from a second nixpkgs input pinned to 26.05, because nixpkgs 26.11 refuses to evaluate on x86_64-darwin. 26.05 stops receiving fixes at the end of 2026, so 0.4.0 dropped the leg, the nixpkgs-x86-darwin input and every x86_64-darwin pin. An Intel Mac can still cargo install either app.

Windows

The windows job builds both apps per architecture on a native runner (windows-2025 for x64, windows-11-arm for arm64), then packages each into an MSI with WiX. Those runners have no Nix, so the leg differs from the Mac legs in three ways:

The installers (assets/windows/*.wxs) are per-user, into %LOCALAPPDATA%\Programs\<App>, so they need no administrator prompt. They add a Start menu shortcut, and Ledgeline adds “Open with” entries for .journal, .hledger, .ledger and .j. The UpgradeCode GUIDs in them must never change, because they make a new MSI replace the old install.

WiX is pinned at 5.0.2. WiX 6 and later ship their binaries under the Open Source Maintenance Fee EULA, while 5 is plain MS-RL. Moving up is a licensing decision, not a version bump.

The MSIs are unsigned. Until they are signed, SmartScreen warns on first run (“Windows protected your PC”, then More info → Run anyway). Signing would go between wix build and the checksums, using Azure Trusted Signing or an OV/EV certificate, with signtool on both the exes and the MSIs.

A dry run builds the MSIs too. You can download them from the run’s page and install them to test.

Re-pinning spaNodeModulesHashes after a JS dependency bump

spaNodeModules is a fixed-output derivation whose hash covers the resolved node_modules, including the native esbuild / rollup / @tailwindcss/oxide binaries. The hash is therefore per-platform, and you can only generate a hash on the platform it describes:

spaNodeModulesHashes = {
  aarch64-darwin = "sha256-…";   # your Mac, or the arm64 runner
  x86_64-linux   = "sha256-…";   # the CI `build` job
};

Any change to a workspace package.json or bun.lock invalidates both at once. just repin-spa-hashes re-pins every one this machine can build. On a Mac that is aarch64-darwin natively, plus x86_64-linux on a remote Linux store. just spa-hash-check (part of pre-push) fails when bun.lock moved and the pins did not.

Only a build catches a stale entry, so the CI build job builds linuxDist and the release matrix builds the Mac. Some job builds every system that has an entry above.

Cutting a release

scripts/release.sh sets the version. Use it rather than editing files by hand. The version lives in several places, and most of them fail silently when they drift.

scripts/release.sh set 0.2.0            # rewrite every reference, verify, stop
git diff                                # review
scripts/release.sh set 0.2.0 --commit   # commit + tag (does NOT push)

git push origin main v0.2.0             # pushing the tag starts the release

The run takes roughly 15–25 minutes when the Cachix layer is warm. Most of that is waiting on Apple for two notarization round trips (the app, then the DMG).

Where the version lives

LocationKept in step byWhat a stale value does
Cargo.toml [workspace.package] versionsource of truth—
Cargo.toml [workspace.dependencies] ledgeline-core.version, ledgeline-shell.version and invoicer-core.versionrelease.sh setNothing locally, because path wins inside the workspace. Breaks cargo publish, at the end of a release
Cargo.lockcargo update --workspaceFails --locked builds in CI
web/package.json, invoicer/web/package.json and their bun.lock entriesrelease.sh setNothing at all. It had already drifted to 0.0.1 against a 0.1.0 workspace before this script existed
The git tagyouPublishes Ledgeline-0.2.0.dmg containing an app that reports 0.1.0 in About and in every crash report forever, because Info.plist comes from Cargo.toml, not from the tag

scripts/release.sh check asserts that all of them agree, and takes an optional tag to check against. It runs in three places, so drift cannot reach a release:

scripts/release.sh current          # print the version
scripts/release.sh check            # assert every reference agrees
scripts/release.sh check v0.2.0     # ...and that the tag matches

Dry runs

Run the workflow manually from the Actions tab with dry_run checked. It builds and packages exactly as a real release does, then stops before signing, notarization and publishing, and uploads the unsigned DMG as a workflow artifact.

Use it whenever the packaging changes. It is the only way to test the DMG layout without using up a version tag.

One-time Apple setup

The release needs five repository secrets, all set under Settings → Secrets and variables → Actions. You need an Apple Developer Program membership ($99/yr).

The signing certificate

MACOS_CERTIFICATE_P12, MACOS_CERTIFICATE_PASSWORD

You need a Developer ID Application certificate, not “Mac App Distribution”. That one only works for the App Store and fails notarization for a directly distributed app.

  1. In Xcode: Settings → Accounts → your team → Manage Certificates → + → Developer ID Application. (Or create the CSR by hand at https://developer.apple.com/account/resources/certificates.)

  2. In Keychain Access, find the certificate, expand it so both the cert and its private key are selected, right-click → Export 2 items…, save as .p12, and set a strong password. You need both halves. A .p12 exported without the private key imports fine and then fails at codesign with “no identity found”.

  3. Base64-encode it, and put the result in MACOS_CERTIFICATE_P12:

    base64 -i DeveloperID.p12 | pbcopy
    
  4. Put the export password in MACOS_CERTIFICATE_PASSWORD.

The workflow derives the signing identity string from the certificate itself, so there is no sixth secret to keep in sync.

The notarization key

APPLE_API_KEY_P8, APPLE_API_KEY_ID, APPLE_API_ISSUER_ID

Notarization uses an App Store Connect API key rather than an Apple ID and app-specific password. The key does not break when 2FA prompts, it is scoped, and you can revoke it on its own.

  1. At https://appstoreconnect.apple.com/access/integrations/api, create a key with the Developer role (that is sufficient for notarization).
  2. Download AuthKey_XXXXXXXXXX.p8. Apple lets you download it exactly once.
  3. APPLE_API_KEY_P8: the output of base64 -i AuthKey_XXXXXXXXXX.p8 | pbcopy.
  4. APPLE_API_KEY_ID: the ten-character Key ID (the XXXXXXXXXX above).
  5. APPLE_API_ISSUER_ID: the UUID shown above the key list on that page. It is per-team, not per-key.

Verifying by hand

The workflow asserts all of this before publishing. When something looks wrong on a downloaded DMG, check it by hand:

# The ticket is stapled and valid offline.
xcrun stapler validate Ledgeline-0.2.0-arm64.dmg

# The string that matters is `source=Notarized Developer ID`. Anything else
# means a user gets a Gatekeeper prompt.
spctl --assess --type exec -vvv /Applications/Ledgeline.app

# Every load command resolves on a stock Mac — no /nix/store, no /opt/homebrew.
otool -L /Applications/Ledgeline.app/Contents/MacOS/ledgeline
otool -L /Applications/Ledgeline.app/Contents/MacOS/hledger

When notarization fails

notarytool submit --wait exits non-zero and the workflow then fetches and prints the full log, which names the file at fault. The usual causes:

Symptom in the logCauseFix
The signature does not include a secure timestamp--timestamp missing, or Apple’s timestamp server was unreachableRe-run; it is usually transient
The executable does not have the hardened runtime enabledA Mach-O got signed without --options runtimeAdd it to the sign() helper’s arguments
The binary is not signed naming Contents/MacOS/<something>A new nested binary was added to the bundle but not to the sign stepAdd it. The sign step lists files explicitly, on purpose
Team is not yet configured for notarizationNew membership, agreements not acceptedAccept the current agreements in App Store Connect

Entitlements. The workflow passes none. The app is not sandboxed, and wry drives WKWebView, whose JIT runs in the out-of-process com.apple.WebKit.WebContent system service rather than in our address space. So com.apple.security.cs.allow-jit and its relatives are not needed. If a future dependency does need one, that is where to look first, and the entitlements plist goes in assets/.

Publishing to crates.io

The publish job runs after the GitHub Release on every tag and pushes five crates, so non-Mac users (and Intel Macs) can install either app:

# Ledgeline, headless — serves the UI over HTTP. Open the
# http://127.0.0.1:PORT/#token=… URL it prints in your own browser; the page
# itself never carries the token.
cargo install ledgeline --no-default-features --features watcher,external-tools

# Ledgeline with the desktop window. On Linux needs webkitgtk-4.1, gtk3,
# libsoup-3 and libxdo (Debian/Ubuntu: libwebkit2gtk-4.1-dev libgtk-3-dev
# libsoup-3.0-dev libxdo-dev).
cargo install ledgeline

# Ledgeline Invoicer, headless (no PDF export): `ledgeline-invoicer --server`.
cargo install ledgeline-invoicer --no-default-features --features server

# Ledgeline Invoicer with the desktop window (the same Linux libraries).
cargo install ledgeline-invoicer
CrateDirectoryWhat it is
ledgeline-corecrates/ledgeline-core/The engine both apps use
ledgeline-shellcrates/ledgeline-shell/The desktop/server shell both apps use
ledgelinecrates/ledgeline-server/Ledgeline (the binary)
ledgeline-invoicer-coreinvoicer/crates/invoicer-core/The invoicer’s documents and booking engine
ledgeline-invoicerinvoicer/crates/ledgeline-invoicer/Ledgeline Invoicer (the binary)

Package and directory names differ on purpose: cargo does not tie them together, and the package name is what a user types. invoicer-core is ledgeline-invoicer-core on the registry (still invoicer_core in code) so every name starts with ledgeline, which is what the CI token is scoped to. The libraries have to be published even though nobody installs them directly, because cargo publish rejects a package whose dependency is not on the registry.

scripts/publish-crates.sh stages both real SPAs (.#spaBuild, .#invoicerSpaBuild) into their crates, refuses build.rs’s placeholder, and publishes all five in ONE cargo publish, which (cargo 1.90+) packages and verify-builds every crate before uploading any. CI runs it with --dry-run in the release workflow’s crates-dry-run job on every run, dry or tagged, and for real in publish. release needs crates-dry-run, so a crate that will not package fails before the GitHub Release exists. just package-crates rehearses the packaging locally.

The one secret

CARGO_REGISTRY_TOKEN, from https://crates.io/settings/tokens.

Until that secret exists the publish step skips with a notice and the job still passes. It runs after the DMGs on purpose. A crates.io release cannot be withdrawn, only yanked, so publishing before the DMGs are known good would permanently use up a version number on a release that never shipped.

The token is scoped to the crate pattern ledgeline*, with publish-new and publish-update. publish-new lets a release introduce a new crate. Without it, 0.3.0’s publish uploaded ledgeline-core, got a 403 on the new ledgeline-shell, and stopped half-published. The pattern keeps it from claiming names outside the project. A new crate whose name does not start with ledgeline would hit the same 403, so name it to fit.

Recovering a half-finished publish

Rerunning the failed publish job can’t finish it. The script tries the crates that already went up first, and cargo stops at “already exists”. Finish from a checkout of the tag instead: stage both SPAs exactly as scripts/publish-crates.sh does, then cargo publish only the crates still missing, with --allow-dirty (the staged spa/ folders are git-ignored by design):

git worktree add ../ledgeline-vX.Y.Z vX.Y.Z && cd ../ledgeline-vX.Y.Z
# stage .#spaBuild → crates/ledgeline-server/spa and
# .#invoicerSpaBuild → invoicer/crates/ledgeline-invoicer/spa, and check
# neither index.html says "SPA not built"
cargo publish --dry-run -p <missing> … --allow-dirty
cargo publish -p <missing> … --allow-dirty

What makes the crate publishable

These details are easy to undo by accident:

Rehearse the whole thing locally without publishing anything:

just package-crates   # builds both SPAs, packages the five crates, counts each crate's spa/ files

Bumping the bundled hledger

flake.nix pins the version and the per-architecture tarball hashes in bundledHledger. To move to a new release:

nix store prefetch-file --hash-type sha256 \
  https://github.com/simonmichael/hledger/releases/download/1.53/hledger-mac-arm64.tar.gz

Update bundledHledgerVersion and the hash, then nix build .#macApp. Then update the Windows pin. Set HLEDGER_VERSION in .github/workflows/release.yml and ci.yml, and HLEDGER_WINDOWS_SHA256 to the sha256 of that release’s hledger-windows-x64.zip (shasum -a 256). scripts/release.sh check fails until the versions agree. The derivation asserts the new binary links only system libraries, so a change in how hledger builds its releases fails there rather than on a user’s Mac.

Keep it at or above MIN_HLEDGER in crates/ledgeline-server/src/hledger.rs (currently 1.40, the release that renamed --rules-file to --rules).

How the app finds hledger

The resolution order is in crates/ledgeline-server/src/hledger.rs. For a downloaded release only step 4 matters, for the reason given below the list:

  1. prefs.hledger_path, set in the settings form.
  2. $LEDGELINE_HLEDGER.
  3. The baked LEDGELINE_HLEDGER_PATH, a /nix/store/… path. It is correct on the build machine, and absent on a user’s Mac, where the stat check drops it.
  4. A sibling hledger (hledger.exe on Windows) next to our own executable. This is the one the DMG and the MSI rely on.
  5. hledger on $PATH.

Step 5 rarely helps a downloaded app. A process launched from Finder or the Dock inherits launchd’s environment, not the one your shell exports from .zshrc. A user whose Homebrew hledger works in their terminal still gets “hledger was not found” from a double-clicked app. That is why the bundle ships its own copy, and why step 4 exists.