Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,17 @@ jobs:
name: windows-installer
path: desktop/installer/Output/*.exe
retention-days: 14

# The macOS disk image, universal, kept likewise (D39).
- name: macOS installer
if: runner.os == 'macOS'
working-directory: .
run: desktop/installer/build-macos.sh "0.0.0-dev.${GITHUB_SHA:0:7}"

- name: Keep the macOS installer
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: macos-installer
path: desktop/installer/Output/*.dmg
retention-days: 14
59 changes: 47 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,57 @@ jobs:
$tag = "${{ github.ref_name }}"
$setup = pwsh desktop/installer/build.ps1 -Version $tag.TrimStart('v') | Select-Object -Last 1
gh release upload $tag $setup --clobber
# GoReleaser wrote checksums.txt before the installer existed. The
# app checks the installer against it before running it (D38), so
# its line is added, replacing any from an earlier run of this job.
$name = Split-Path $setup -Leaf
$hash = (Get-FileHash $setup -Algorithm SHA256).Hash.ToLower()
New-Item -ItemType Directory -Force sums | Out-Null
gh release download $tag -p checksums.txt -D sums --clobber
$lines = @(Get-Content sums/checksums.txt | Where-Object { $_ -and -not $_.EndsWith(" $name") })
$lines += "$hash $name"
[IO.File]::WriteAllText("$PWD/sums/checksums.txt", ($lines -join "`n") + "`n")
gh release upload $tag sums/checksums.txt --clobber

# The macOS installer: Filiation.app with fil inside, universal, on a disk
# image (D39).
macos-installer:
needs: release
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: desktop/go.mod
cache-dependency-path: desktop/go.sum

- name: Build and attach the installer
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${{ github.ref_name }}"
dmg=$(desktop/installer/build-macos.sh "${tag#v}" | tail -1)
gh release upload "$tag" "$dmg" --clobber

# GoReleaser wrote checksums.txt before the installers existed. The Windows
# app checks its installer against it before running it (D38), and anyone
# can check the disk image, so their lines are added, replacing any from an
# earlier run. One job, after both, so the two never overwrite each other.
installer-checksums:
needs: [windows-installer, macos-installer]
runs-on: ubuntu-latest
steps:
- name: Add the installers to checksums.txt
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
tag="${{ github.ref_name }}"
mkdir sums installers
gh release download "$tag" -p checksums.txt -D sums
gh release download "$tag" -p 'Filiation-*' -D installers
cd installers
names=$(ls)
grep -v -F -f <(printf ' %s\n' $names) ../sums/checksums.txt > ../sums/new.txt || true
sha256sum $names >> ../sums/new.txt
mv ../sums/new.txt ../sums/checksums.txt
cat ../sums/checksums.txt
gh release upload "$tag" ../sums/checksums.txt --clobber

# The website names the newest release and links to its installer; publish
# it again now the release is complete (pages.yml).
website:
needs: windows-installer
needs: installer-checksums
runs-on: ubuntu-latest
permissions:
actions: write
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

A desktop window for Windows, macOS and Linux, for people who would rather not use a terminal: your papers, search, the citation map, the Reader with highlights, notes and several papers open in tabs, and connecting your AI assistant with one click. On Windows it keeps itself up to date.

On Windows, [download the installer](https://codevector-2003.github.io/filiation/docs/install/): no administrator rights needed. On macOS and Linux the app builds from source for now: see [the desktop app](desktop/README.md).
On Windows, [download the installer](https://codevector-2003.github.io/filiation/docs/install/): no administrator rights needed. On macOS, download the disk image from the latest release and drag Filiation onto Applications; it runs on Apple silicon and Intel. On Linux the app builds from source for now: see [the desktop app](desktop/README.md).

</td>
<td width="50%" valign="top">
Expand Down
25 changes: 25 additions & 0 deletions desktop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,28 @@ and compiles `installer/filiation.iss` with Inno Setup 6 into
Chocolatey when missing. The release workflow attaches the installer to each release, and every
pull request's desktop build keeps one as a download. D37 in [`docs/DECISIONS.md`](../docs/DECISIONS.md)
says what it does and why.

## The macOS installer

`installer/build-macos.sh <version>` builds `fil` and the app for Apple silicon and Intel, joins
each pair with `lipo`, and puts them in one `Filiation.app`, with `fil` in `Contents/MacOS` beside
the app's own executable. It signs the bundle ad hoc and puts it on a disk image,
`installer/Output/Filiation-<version>-macos-universal.dmg`, beside a link to Applications. It needs
a Mac with the Xcode command line tools, and takes about a minute. The oldest macOS it runs on is
the oldest the Go toolchain supports (12 with Go 1.26), read from the built `fil`. The release
workflow attaches it to each release, and every desktop build keeps one as a download. D39 in
[`docs/DECISIONS.md`](../docs/DECISIONS.md) says what it does and why.

The icon is `installer/icon-macos.svg`, the Windows tile shrunk to Apple's grid. After changing
it, pack it again:

```sh
qlmanage -t -s 1024 -o . installer/icon-macos.svg
mkdir icon.iconset
for s in 16 32 128 256 512; do
sips -z $s $s icon-macos.svg.png --out icon.iconset/icon_${s}x${s}.png
sips -z $((s*2)) $((s*2)) icon-macos.svg.png --out icon.iconset/icon_${s}x${s}@2x.png
done
iconutil -c icns icon.iconset -o installer/filiation.icns
rm -r icon.iconset icon-macos.svg.png
```
103 changes: 103 additions & 0 deletions desktop/installer/build-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/env bash
# Builds the macOS installer: Filiation.app, with fil inside it, for Apple
# silicon and Intel in one universal bundle, on a disk image to drag to
# Applications (D39). Used by CI for pull requests and releases, and by hand:
#
# desktop/installer/build-macos.sh 0.4.5
#
# Needs a Mac with the Xcode command line tools. Prints the disk image's path.
set -euo pipefail

version=${1:?usage: build-macos.sh <version>}
here=$(cd "$(dirname "$0")" && pwd)
root=$(cd "$here/../.." && pwd)
build="$here/build/macos"
out="$here/Output"
app="$build/Filiation.app"
dmg="$out/Filiation-$version-macos-universal.dmg"

rm -rf "$build"
mkdir -p "$build" "$out"

# Hard rule 4: fil is one static binary, no cgo.
for arch in arm64 amd64; do
(cd "$root" && CGO_ENABLED=0 GOOS=darwin GOARCH=$arch \
go build -trimpath -ldflags "-s -w -X main.Version=$version" -o "$build/fil-$arch" ./cmd/fil)
done

# The oldest macOS the app runs on is the oldest the Go toolchain supports;
# the desktop shell is built for the same, and Info.plist says so. Never
# below Big Sur, the first with the UniformTypeIdentifiers framework.
minos=$(otool -l "$build/fil-arm64" | awk '/LC_BUILD_VERSION/ {f=1} f && $1 == "minos" {print $2; exit}')
case "$minos" in ""|10.*) minos=11.0 ;; esac
export MACOSX_DEPLOYMENT_TARGET=$minos

# The desktop shell is the one place cgo is allowed (D24). Go passes the right
# -arch to clang, so both build on either kind of Mac. Wails v2 does not link
# UniformTypeIdentifiers, which the Xcode 26 SDK needs.
for arch in arm64 amd64; do
(cd "$root/desktop" && CGO_ENABLED=1 GOOS=darwin GOARCH=$arch \
CGO_LDFLAGS="-framework UniformTypeIdentifiers" \
go build -trimpath -tags desktop,production -ldflags "-s -w -X main.version=$version" -o "$build/Filiation-$arch" .)
done

mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
lipo -create -output "$app/Contents/MacOS/Filiation" "$build/Filiation-arm64" "$build/Filiation-amd64"
# fil sits beside the app's own executable: assistants connected from the AI
# assistants screen are given its full path (filCommand in desktop/main.go).
lipo -create -output "$app/Contents/MacOS/fil" "$build/fil-arm64" "$build/fil-amd64"
cp "$here/filiation.icns" "$app/Contents/Resources/filiation.icns"
printf 'APPL????' > "$app/Contents/PkgInfo"

# Never change CFBundleIdentifier: macOS keys the app's permissions and
# preferences to it.
cat > "$app/Contents/Info.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key><string>Filiation</string>
<key>CFBundleDisplayName</key><string>Filiation</string>
<key>CFBundleIdentifier</key><string>io.github.codevector-2003.filiation</string>
<key>CFBundleExecutable</key><string>Filiation</string>
<key>CFBundleIconFile</key><string>filiation</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>$version</string>
<key>CFBundleVersion</key><string>$version</string>
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
<key>LSMinimumSystemVersion</key><string>$minos</string>
<key>LSApplicationCategoryType</key><string>public.app-category.reference</string>
<key>NSHighResolutionCapable</key><true/>
<key>NSSupportsAutomaticGraphicsSwitching</key><true/>
<key>NSHumanReadableCopyright</key><string>Apache License 2.0</string>
</dict>
</plist>
EOF
plutil -lint "$app/Contents/Info.plist" >/dev/null

# Signed ad hoc, not with a Developer ID, and not notarised (D39): Apple
# silicon runs nothing unsigned, and lipo's output must be signed again.
# Inside out: fil first, then the bundle that seals it. No hardened runtime,
# which would forbid the WebAssembly compilers (SQLite, PDFium) their
# executable memory without an entitlement.
codesign --force --sign - --timestamp=none "$app/Contents/MacOS/fil"
codesign --force --sign - --timestamp=none "$app"
codesign --verify --strict "$app"

# The disk image: the app and a link to Applications to drag it onto.
stage="$build/dmg"
mkdir -p "$stage"
cp -R "$app" "$stage/"
ln -s /Applications "$stage/Applications"
rm -f "$dmg"
# hdiutil now and then fails with "Resource busy" on CI runners; try again.
for try in 1 2 3; do
if hdiutil create -quiet -volname "Filiation $version" -srcfolder "$stage" \
-fs HFS+ -format UDZO -ov "$dmg"; then
break
fi
[ "$try" = 3 ] && { echo "hdiutil failed" >&2; exit 1; }
sleep 5
done

echo "$dmg"
Binary file added desktop/installer/filiation.icns
Binary file not shown.
22 changes: 22 additions & 0 deletions desktop/installer/icon-macos.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 34 additions & 1 deletion docs/DECISIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ request's desktop build.
- **The icon** is the stemma as the title bar draws it, bold enough to read at 16 px, on a white
tile (`desktop/installer/icon.svg`, packed into `filiation.ico`). It is used by Setup, the
shortcuts and the uninstall entry. The exe itself has no icon resource yet.
- Windows first: a macOS `.dmg` and Linux AppImage and `.deb` follow, as does a first-run welcome
- Windows first: a macOS `.dmg` (D39) and Linux AppImage and `.deb` follow, as does a first-run welcome
in the app and a check for new versions.

## D38 — The app updates itself on Windows, from GitHub releases
Expand Down Expand Up @@ -999,3 +999,36 @@ Windows installs it when asked.
the installer (D37) is what would add that.
- **Every version before this one updates by hand once.** The feature exists only from the version
that ships it.

## D39 — The macOS installer: one universal app on a disk image, signed ad hoc for now

Decided 2 Dec 2026, by the maintainer. The desktop app had no macOS build to download; it was built
from source. Each release now carries `Filiation-<version>-macos-universal.dmg`, built by
`desktop/installer/build-macos.sh` on a macOS runner, in the release workflow and, kept as a
download, on every desktop build.

- **A disk image, not a `.pkg`.** Drag Filiation onto Applications, the way most Mac apps install.
It needs no administrator password and runs no script, and removing it is dragging it to the Bin.
- **One app for Apple silicon and Intel.** Each binary is built for both and joined with `lipo`,
so there is one download to choose, at about twice the size of either.
- **fil comes inside the app**, in `Contents/MacOS` beside the app's executable, where the app
already looks for it: assistants connected from the AI assistants screen are given its full
path. A disk image cannot change the PATH, so using fil in a terminal is one `ln -s`, given in
the install page. The `fil` archives for macOS are unchanged.
- **The oldest macOS is Go's.** The script reads the minimum from the built `fil` and builds the
window shell for the same, so `LSMinimumSystemVersion` is never a guess: 12 Monterey with Go 1.26.
- **Signed ad hoc, not notarised, for now.** Apple silicon runs nothing unsigned, so the bundle is
signed ad hoc, inside out. Without a Developer ID, Gatekeeper refuses the first open; the
person allows it once in System Settings › Privacy & Security, as the install page says. A
Developer ID and notarisation can be added in the release job later without changing the bundle.
No hardened runtime: it would forbid the WebAssembly compilers (SQLite, PDFium) their executable
memory without an entitlement, and it matters only with notarisation.
- **The bundle identifier is `io.github.codevector-2003.filiation`.** It must never change: macOS
keys the app's permissions and preferences to it.
- **Updates stay on the download page.** The app already offers the release page outside Windows
(D38). Replacing a running app bundle in place is a different job from running Setup, and is
left until the app is notarised. The disk image is added to `checksums.txt`, by one job after
both installers, so the Windows and macOS jobs never overwrite each other's line.
- **The icon** is the Windows tile shrunk to Apple's 824-of-1024 grid, so it sits the same size as
other apps in the Dock (`desktop/installer/icon-macos.svg`, packed into `filiation.icns`).
- Linux follows: an AppImage and a `.deb`.
Loading
Loading