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):
| Installer | App | Built by |
|---|---|---|
Ledgeline-X.Y.Z-arm64.dmg | Ledgeline.app | package leg, flake.nix macApp |
LedgelineInvoicer-X.Y.Z-arm64.dmg | Ledgeline Invoicer.app | package leg, flake.nix invoicerMacApp |
Ledgeline-X.Y.Z-windows-x64.msi | ledgeline.exe | windows leg (x64), assets/windows/ledgeline.wxs |
Ledgeline-X.Y.Z-windows-arm64.msi | ledgeline.exe | windows leg (arm64), the same |
LedgelineInvoicer-X.Y.Z-windows-x64.msi | ledgeline-invoicer.exe | windows leg (x64), assets/windows/ledgeline-invoicer.wxs |
LedgelineInvoicer-X.Y.Z-windows-arm64.msi | ledgeline-invoicer.exe | windows 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:
- Self-contained. Every load command in both Mach-O files resolves against
the base OS (
/usr/lib/*and system frameworks).flake.nixasserts this at build time, so a bundle that would only launch on the build machine fails the build instead of failing on a user’s Mac. - Complete for imports.
hledger1.52.4 is bundled inContents/MacOS/hledger, beside the app binary. Users install nothing else. - Signed and notarized. The ticket is stapled into both the app and the DMG, so a downloaded copy opens normally, including offline.
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 SPAs come from Linux. The
spasjob builds.#spaBuildand.#invoicerSpaBuildwith Nix and hands them over as an artifact, so the MSIs embed the same bytes as the DMGs. The leg checks that neither binary embeds build.rs’s placeholder. - It uses rustup, not the flake’s toolchain.
rust-toolchain.tomlsaysstable, so a Windows build can be a newer stable than the flake’s pinned one. - It fetches hledger by version. The leg downloads
hledger-windows-x64.zipforHLEDGER_VERSIONand checks it againstHLEDGER_WINDOWS_SHA256(both inrelease.ymlandci.yml).scripts/release.sh checkfails whenHLEDGER_VERSIONdiffers fromflake.nix’sbundledHledgerVersion. hledger publishes x64 only; the arm64 MSI carries the x64 hledger, which Windows on Arm runs emulated.
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
| Location | Kept in step by | What a stale value does |
|---|---|---|
Cargo.toml [workspace.package] version | source of truth | — |
Cargo.toml [workspace.dependencies] ledgeline-core.version, ledgeline-shell.version and invoicer-core.version | release.sh set | Nothing locally, because path wins inside the workspace. Breaks cargo publish, at the end of a release |
Cargo.lock | cargo update --workspace | Fails --locked builds in CI |
web/package.json, invoicer/web/package.json and their bun.lock entries | release.sh set | Nothing at all. It had already drifted to 0.0.1 against a 0.1.0 workspace before this script existed |
| The git tag | you | Publishes 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:
- the
versionsCI job, on every PR - the release workflow’s
packagejob, against the tag - the release workflow’s
publishjob, again
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.
-
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.)
-
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.p12exported without the private key imports fine and then fails atcodesignwith “no identity found”. -
Base64-encode it, and put the result in
MACOS_CERTIFICATE_P12:base64 -i DeveloperID.p12 | pbcopy -
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.
- At https://appstoreconnect.apple.com/access/integrations/api, create a key with the Developer role (that is sufficient for notarization).
- Download
AuthKey_XXXXXXXXXX.p8. Apple lets you download it exactly once. APPLE_API_KEY_P8: the output ofbase64 -i AuthKey_XXXXXXXXXX.p8 | pbcopy.APPLE_API_KEY_ID: the ten-character Key ID (theXXXXXXXXXXabove).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 log | Cause | Fix |
|---|---|---|
The signature does not include a secure timestamp | --timestamp missing, or Apple’s timestamp server was unreachable | Re-run; it is usually transient |
The executable does not have the hardened runtime enabled | A Mach-O got signed without --options runtime | Add 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 step | Add it. The sign step lists files explicitly, on purpose |
Team is not yet configured for notarization | New membership, agreements not accepted | Accept 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
| Crate | Directory | What it is |
|---|---|---|
ledgeline-core | crates/ledgeline-core/ | The engine both apps use |
ledgeline-shell | crates/ledgeline-shell/ | The desktop/server shell both apps use |
ledgeline | crates/ledgeline-server/ | Ledgeline (the binary) |
ledgeline-invoicer-core | invoicer/crates/invoicer-core/ | The invoicer’s documents and booking engine |
ledgeline-invoicer | invoicer/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:
lib.rsembeds$CARGO_MANIFEST_DIR/spa, not../../web/build.cargo packagerefuses to include files outside the package root, so the old path made the crate unpublishable. It would have shipped with no UI.build.rshas three cases (workspace / published crate / neither). The published-crate case must never overwrite the shippedspa/, or everycargo installserves the placeholder.spa/is git-ignored (it is a build artifact) but named inledgeline’sincludelist, which overrides.gitignoreat packaging time.- The workflow asserts the staged SPA is not the placeholder before publishing. A placeholder packages exactly like the real thing, with the same filename, the same manifest, and no warning. The result would be a published version, which yanking cannot remove, whose entire UI is an error page.
ledgeline-coreandledgeline-shellcarry aversionin the workspace dependency table.cargo publishrejects a path dependency without one.
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:
prefs.hledger_path, set in the settings form.$LEDGELINE_HLEDGER.- 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. - A sibling
hledger(hledger.exeon Windows) next to our own executable. This is the one the DMG and the MSI rely on. hledgeron$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.