From c2a117ca02ed20a0403c978cb65571f84db73588 Mon Sep 17 00:00:00 2001 From: PJ Date: Sun, 6 Sep 2026 13:52:57 +0530 Subject: [PATCH] fix Windows fixtures and Flatpak CI packaging --- .gitattributes | 3 +++ .github/workflows/ci.yml | 3 +-- .github/workflows/release.yml | 2 +- docs/release.md | 5 +++++ flatpak/build.sh | 5 ++++- flatpak/studio.margin.mail.metainfo.xml | 2 +- flatpak/studio.margin.mail.yml | 8 ++++++-- justfile | 12 ++++++++++++ 8 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ba6e1d4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +# MIME fixtures and golden renders contain intentional CRLF and mixed line endings. +# Preserve their bytes on Windows too; checkout conversion breaks exact comparisons. +src-tauri/fixtures/** -text diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb2ade0..9b12a94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,8 +167,7 @@ jobs: libxdo-dev \ libssl-dev \ build-essential \ - flatpak \ - flatpak-builder + flatpak - uses: actions/setup-node@v6 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3f99d19..3079aa3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -240,7 +240,7 @@ jobs: - run: | sudo apt-get update - sudo apt-get install -y flatpak flatpak-builder + sudo apt-get install -y flatpak - name: Build the flatpak from the published deb env: diff --git a/docs/release.md b/docs/release.md index fc5277d..06be920 100644 --- a/docs/release.md +++ b/docs/release.md @@ -105,6 +105,11 @@ against. The sandbox gets the network, the notification service and the download nothing else. CI builds the same manifest on every push to main, against a deb built there, which is the only way a break in it gets found before a release. +On Linux, `just flatpak` builds the deb and repackages it locally. Install `flatpak` first; the +build script installs the GNOME runtime and `org.flatpak.Builder` from Flathub for your user. +Both CI and local builds use that builder because Ubuntu 22.04's `flatpak-builder` calls the old +`appstream-compose` tool, which the GNOME 48 SDK no longer includes. + The **nix** job runs after the publish, so the flake can only ever point at a release that survived the manifest check. It hashes the published deb into `nix/release.json`, builds the package to prove the pin works, and commits the pin to main. `NIXPKGS_ALLOW_UNFREE` and `--impure` are in that diff --git a/flatpak/build.sh b/flatpak/build.sh index d2ffd32..a326710 100755 --- a/flatpak/build.sh +++ b/flatpak/build.sh @@ -18,11 +18,14 @@ runtime_version=$(sed -n "s/^runtime-version: *'\(.*\)'/\1/p" "$id.yml") # --user so nothing here needs root, and --if-not-exists so a second run is free. flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak install --user --noninteractive flathub \ + org.flatpak.Builder \ "org.gnome.Platform//$runtime_version" \ "org.gnome.Sdk//$runtime_version" rm -rf build repo -flatpak-builder --user --disable-rofiles-fuse --force-clean --repo=repo build "$id.yml" +# Ubuntu 22.04's builder calls appstream-compose, which GNOME 48 no longer ships. +# Use the Flathub builder for its current AppStream support on CI and local builds alike. +flatpak run org.flatpak.Builder --user --disable-rofiles-fuse --force-clean --repo=repo build "$id.yml" flatpak build-bundle repo "$bundle" "$id" echo "Wrote $bundle" diff --git a/flatpak/studio.margin.mail.metainfo.xml b/flatpak/studio.margin.mail.metainfo.xml index de8d4bf..656f0b0 100644 --- a/flatpak/studio.margin.mail.metainfo.xml +++ b/flatpak/studio.margin.mail.metainfo.xml @@ -5,7 +5,7 @@ A calm, keyboard-first mail client for Gmail CC0-1.0 - LicenseRef-proprietary=https://github.com/priyanshujain/margin-mail/blob/main/LICENSE + LicenseRef-FSL-1.1-MIT=https://github.com/priyanshujain/margin-mail/blob/main/LICENSE Margin diff --git a/flatpak/studio.margin.mail.yml b/flatpak/studio.margin.mail.yml index 311c06f..7e48109 100644 --- a/flatpak/studio.margin.mail.yml +++ b/flatpak/studio.margin.mail.yml @@ -39,9 +39,13 @@ modules: # after the product and the binary, so both are renamed on the way in. - install -Dm644 "deb/usr/share/applications/Margin Mail.desktop" /app/share/applications/studio.margin.mail.desktop - desktop-file-edit --set-icon=studio.margin.mail /app/share/applications/studio.margin.mail.desktop + # Only the plainly named sizes. Tauri also writes a `256x256@2` directory, and hicolor spells + # a scaled one `256x256@2x`, so flatpak would be exporting an icon at a size that is not a + # size. - | - for src in deb/usr/share/icons/hicolor/*/apps/margin-mail.png; do - size=$(basename "$(dirname "$(dirname "$src")")") + for size in 32x32 128x128; do + src="deb/usr/share/icons/hicolor/$size/apps/margin-mail.png" + [ -f "$src" ] || continue install -Dm644 "$src" "/app/share/icons/hicolor/$size/apps/studio.margin.mail.png" done diff --git a/justfile b/justfile index 9f64545..8c0f39f 100644 --- a/justfile +++ b/justfile @@ -58,6 +58,18 @@ build: *) echo "just: no local build for $(uname -s); macOS and Linux are the desktop targets." >&2; exit 1 ;; esac +# Wants flatpak, and pulls the Flathub builder and GNOME runtime if they are not installed. +# The release workflow runs the same script over the deb it published. +# Build the flatpak, which is the deb repackaged. Linux only. +flatpak: + #!/usr/bin/env bash + set -euo pipefail + [ "$(uname -s)" = Linux ] || { echo "just: the flatpak builds on Linux only." >&2; exit 1; } + pnpm install + pnpm tauri build --bundles deb + cp {{bundle}}/deb/*.deb flatpak/margin-mail.deb + flatpak/build.sh + # Build, install over whatever version is already installed, and start the new one. install: build #!/usr/bin/env bash