From 223de87fb9b449c9d53c6c097bdf0b97041253ef Mon Sep 17 00:00:00 2001 From: Erwan Leboucher Date: Wed, 26 Aug 2026 10:33:10 +0200 Subject: [PATCH] feat(flatpak): publish a nightly channel Nightlies get their own Flatpak repo, served from GitHub Pages under the moe.sable.client.Nightly application ID so they install alongside the stable Flathub build. Flathub cannot host this: its requirements exclude nightly releases and software needing daily updates from both the stable and beta repos, duplicate submissions of the same app are not accepted, and flathub-beta takes no new submissions. The payload stays on the nightly release as extra-data, keeping each OSTree commit small enough for Pages. The repo is rebuilt from scratch every night because an older commit's extra-data URL points at a release asset that has since been pruned, so the asset cleanup now keeps the three newest Linux tarballs. Publishing needs Pages enabled with the GitHub Actions source, plus FLATPAK_GPG_KEY and FLATPAK_GPG_KEY_ID; the job skips with a notice until they exist. --- .github/scripts/render-flatpak-nightly.mjs | 84 ++++++++ .github/workflows/tauri-build.yml | 199 +++++++++++++++++- .gitignore | 4 + README.md | 9 + packaging/flatpak/nightly/index.html.in | 93 ++++++++ .../nightly/moe.sable.client.Nightly.desktop | 10 + .../moe.sable.client.Nightly.metainfo.xml.in | 70 ++++++ .../nightly/moe.sable.client.Nightly.yml.in | 100 +++++++++ .../nightly/sable-nightly.flatpakrepo.in | 9 + 9 files changed, 575 insertions(+), 3 deletions(-) create mode 100644 .github/scripts/render-flatpak-nightly.mjs create mode 100644 packaging/flatpak/nightly/index.html.in create mode 100644 packaging/flatpak/nightly/moe.sable.client.Nightly.desktop create mode 100644 packaging/flatpak/nightly/moe.sable.client.Nightly.metainfo.xml.in create mode 100644 packaging/flatpak/nightly/moe.sable.client.Nightly.yml.in create mode 100644 packaging/flatpak/nightly/sable-nightly.flatpakrepo.in diff --git a/.github/scripts/render-flatpak-nightly.mjs b/.github/scripts/render-flatpak-nightly.mjs new file mode 100644 index 000000000..9441de37b --- /dev/null +++ b/.github/scripts/render-flatpak-nightly.mjs @@ -0,0 +1,84 @@ +#!/usr/bin/env node +/* oxlint-disable no-console */ + +// Usage: render-flatpak-nightly.mjs [date] +// Pass "-" for an architecture that is not being published. + +import { readFileSync, writeFileSync } from 'node:fs'; +import process from 'node:process'; + +const [version, x86, arm, dateArg] = process.argv.slice(2); + +if (!version || !x86 || !arm) { + console.error( + 'Usage: render-flatpak-nightly.mjs [date]' + ); + process.exit(1); +} + +const parseArch = (arch, value) => { + if (value === '-') return null; + const [sha, sizeStr] = value.split(':'); + if (!/^[0-9a-f]{64}$/.test(sha ?? '')) { + console.error(`${arch}: expected a 64-character sha256 (got: ${sha})`); + process.exit(1); + } + const size = Number(sizeStr); + if (!Number.isInteger(size) || size <= 0) { + console.error(`${arch}: expected a positive integer size (got: ${sizeStr})`); + process.exit(1); + } + return { sha, size }; +}; + +const arches = { + x86_64: parseArch('x86_64', x86), + aarch64: parseArch('aarch64', arm), +}; + +if (!arches.x86_64 && !arches.aarch64) { + console.error('At least one architecture must be published.'); + process.exit(1); +} + +const date = dateArg || new Date().toISOString().slice(0, 10); +const dir = 'packaging/flatpak/nightly'; + +let manifest = readFileSync(`${dir}/moe.sable.client.Nightly.yml.in`, 'utf8').replaceAll( + '@VERSION@', + version +); + +for (const [arch, values] of Object.entries(arches)) { + const suffix = arch.toUpperCase(); + if (values) { + manifest = manifest + .replaceAll(`@SHA256_${suffix}@`, values.sha) + .replaceAll(`@SIZE_${suffix}@`, String(values.size)); + continue; + } + const block = new RegExp( + ` - type: extra-data\\n(?: .*\\n)*? only-arches: \\[${arch}\\]\\n` + ); + if (!block.test(manifest)) { + console.error(`Could not find the ${arch} extra-data source to drop.`); + process.exit(1); + } + manifest = manifest.replace(block, ''); +} + +const leftover = manifest.match(/@[A-Z0-9_]+@/); +if (leftover) { + console.error(`Unsubstituted placeholder left in the manifest: ${leftover[0]}`); + process.exit(1); +} + +writeFileSync(`${dir}/moe.sable.client.Nightly.yml`, manifest); +writeFileSync( + `${dir}/moe.sable.client.Nightly.metainfo.xml`, + readFileSync(`${dir}/moe.sable.client.Nightly.metainfo.xml.in`, 'utf8') + .replaceAll('@VERSION@', version) + .replaceAll('@DATE@', date) +); + +console.log(`Rendered the nightly Flatpak manifest for ${version} (${date})`); diff --git a/.github/workflows/tauri-build.yml b/.github/workflows/tauri-build.yml index 74ef1ca2c..0aafdceb8 100644 --- a/.github/workflows/tauri-build.yml +++ b/.github/workflows/tauri-build.yml @@ -632,12 +632,23 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | + gh release view nightly --json assets > nightly-assets.json + + # extra-data URLs in the published Flatpak repo point at these. + jq -r '[.assets[] | select(.name | test("-linux-(x86_64|aarch64)\\.tar\\.gz$"))] + | sort_by(.updatedAt) | reverse | .[0:3] | .[].name' \ + nightly-assets.json > flatpak-keep.txt + # .json manifests are overwritten in place, not accumulated. - gh release view nightly --json assets \ - | jq -r --arg cutoff "$STARTED_AT" \ - '.assets[] | select(.updatedAt <= $cutoff and (.name | endswith(".json") | not)) | .name' \ + jq -r --arg cutoff "$STARTED_AT" \ + '.assets[] | select(.updatedAt <= $cutoff and (.name | endswith(".json") | not)) | .name' \ + nightly-assets.json \ | while read -r name; do [ -n "$name" ] || continue + if grep -Fxq "$name" flatpak-keep.txt; then + echo "Keeping $name for the nightly Flatpak" + continue + fi echo "Removing superseded nightly asset: $name" gh release delete-asset nightly "$name" --yes done @@ -846,6 +857,188 @@ jobs: git commit -m "nightly ${VERSION}" git push + build-nightly-flatpak: + name: Build nightly Flatpak ${{ matrix.arch }} + needs: [setup-release, linux] + runs-on: ${{ matrix.runner }} + timeout-minutes: 30 + if: ${{ needs.setup-release.outputs.nightly == 'true' }} + strategy: + fail-fast: false + matrix: + # x86_64 only, matching packaging/flatpak/flathub.json. + include: + - arch: x86_64 + runner: ubuntu-24.04 + permissions: + contents: read + env: + ARCH: ${{ matrix.arch }} + VERSION: ${{ needs.setup-release.outputs.version }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install flatpak-builder + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends flatpak flatpak-builder + flatpak remote-add --user --if-not-exists flathub \ + https://dl.flathub.org/repo/flathub.flatpakrepo + + - name: Measure the release tarball + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + TARBALL="Sable-${VERSION}-linux-${ARCH}.tar.gz" + gh release download nightly --repo "$GITHUB_REPOSITORY" \ + --pattern "$TARBALL" --dir tarball + echo "SHA256=$(sha256sum "tarball/$TARBALL" | awk '{print $1}')" >> "$GITHUB_ENV" + echo "SIZE=$(stat -c %s "tarball/$TARBALL")" >> "$GITHUB_ENV" + + - name: Render the manifest + shell: bash + run: | + if [ "$ARCH" = "x86_64" ]; then + node .github/scripts/render-flatpak-nightly.mjs "$VERSION" "$SHA256:$SIZE" - + else + node .github/scripts/render-flatpak-nightly.mjs "$VERSION" - "$SHA256:$SIZE" + fi + + - name: Build the Flatpak + shell: bash + run: | + # rofiles-fuse is unavailable on hosted runners. + flatpak-builder \ + --user \ + --install-deps-from=flathub \ + --force-clean \ + --disable-rofiles-fuse \ + --default-branch=master \ + --repo=repo \ + builddir packaging/flatpak/nightly/moe.sable.client.Nightly.yml + + - name: Upload the exported repo + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: flatpak-nightly-repo-${{ matrix.arch }} + path: repo + if-no-files-found: error + retention-days: 1 + include-hidden-files: true + + publish-nightly-flatpak: + name: Publish the nightly Flatpak repo + needs: [setup-release, build-nightly-flatpak] + runs-on: ubuntu-24.04 + timeout-minutes: 15 + if: ${{ needs.setup-release.outputs.nightly == 'true' }} + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deploy.outputs.page_url }} + env: + VERSION: ${{ needs.setup-release.outputs.version }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Check for the signing key + id: gate + shell: bash + env: + FLATPAK_GPG_KEY: ${{ secrets.FLATPAK_GPG_KEY }} + FLATPAK_GPG_KEY_ID: ${{ secrets.FLATPAK_GPG_KEY_ID }} + run: | + if [ -z "${FLATPAK_GPG_KEY:-}" ] || [ -z "${FLATPAK_GPG_KEY_ID:-}" ]; then + echo "::notice::FLATPAK_GPG_KEY/FLATPAK_GPG_KEY_ID are not set; skipping the Flatpak publish." + echo "enabled=false" >> "$GITHUB_OUTPUT" + else + echo "enabled=true" >> "$GITHUB_OUTPUT" + fi + + - name: Install flatpak + if: ${{ steps.gate.outputs.enabled == 'true' }} + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends flatpak ostree + + - name: Download the exported repos + if: ${{ steps.gate.outputs.enabled == 'true' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + pattern: flatpak-nightly-repo-* + path: arch-repos + + - name: Import the signing key + if: ${{ steps.gate.outputs.enabled == 'true' }} + shell: bash + env: + FLATPAK_GPG_KEY: ${{ secrets.FLATPAK_GPG_KEY }} + run: | + export GNUPGHOME="$RUNNER_TEMP/gnupg" + mkdir -p "$GNUPGHOME" + chmod 700 "$GNUPGHOME" + printf '%s\n' "$FLATPAK_GPG_KEY" | gpg --batch --import + echo "GNUPGHOME=$GNUPGHOME" >> "$GITHUB_ENV" + + - name: Assemble and sign the repo + if: ${{ steps.gate.outputs.enabled == 'true' }} + shell: bash + env: + FLATPAK_GPG_KEY_ID: ${{ secrets.FLATPAK_GPG_KEY_ID }} + run: | + # A fresh repo each night: older commits point at pruned assets. + ostree --repo=site/repo init --mode=archive-z2 + for src in arch-repos/*/; do + echo "Pulling $src" + ostree --repo=site/repo pull-local "$src" + done + flatpak build-update-repo \ + --title="Sable Nightly" \ + --default-branch=master \ + --gpg-sign="$FLATPAK_GPG_KEY_ID" \ + --gpg-homedir="$GNUPGHOME" \ + site/repo + ostree --repo=site/repo refs + + - name: Write the .flatpakrepo and landing page + if: ${{ steps.gate.outputs.enabled == 'true' }} + shell: bash + env: + FLATPAK_GPG_KEY_ID: ${{ secrets.FLATPAK_GPG_KEY_ID }} + run: | + OWNER="${GITHUB_REPOSITORY%%/*}" + NAME="${GITHUB_REPOSITORY##*/}" + BASE="https://$(printf '%s' "$OWNER" | tr '[:upper:]' '[:lower:]').github.io/$NAME" + GPGKEY="$(gpg --homedir "$GNUPGHOME" --export "$FLATPAK_GPG_KEY_ID" | base64 -w0)" + + sed -e "s|@REPO_URL@|$BASE/repo/|" -e "s|@GPGKEY@|$GPGKEY|" \ + packaging/flatpak/nightly/sable-nightly.flatpakrepo.in \ + > site/sable-nightly.flatpakrepo + + sed -e "s|@BASE_URL@|$BASE|g" -e "s|@VERSION@|$VERSION|g" \ + packaging/flatpak/nightly/index.html.in > site/index.html + + - name: Upload the Pages artifact + if: ${{ steps.gate.outputs.enabled == 'true' }} + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: site + + - name: Deploy to GitHub Pages + id: deploy + if: ${{ steps.gate.outputs.enabled == 'true' }} + uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 + distribute-homebrew: name: Publish Homebrew cask needs: [setup-release, build] diff --git a/.gitignore b/.gitignore index a628fd714..d4bec0f0f 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,7 @@ result ## auto-generated pre-commit config .pre-commit-config.yaml src-tauri/icons/generated/ + +# Rendered by render-flatpak-nightly.mjs +packaging/flatpak/nightly/moe.sable.client.Nightly.yml +packaging/flatpak/nightly/moe.sable.client.Nightly.metainfo.xml diff --git a/README.md b/README.md index 4d3c32dd4..edf105f55 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,15 @@ brew install --cask SableClient/sable/sable The fully qualified name matters: since [Homebrew 6.0.0](https://brew.sh/2026/06/11/homebrew-6.0.0/) non-official taps need explicit trust, and installing this way trusts just this one cask. `brew tap` followed by a short-name install now fails unless you also run `brew trust`. +On Linux, nightly builds have their own Flatpak remote, rebuilt from `dev` every night: + +```sh +flatpak remote-add --if-not-exists sable-nightly https://sableclient.github.io/Sable/sable-nightly.flatpakrepo +flatpak install sable-nightly moe.sable.client.Nightly +``` + +It installs alongside the stable Flathub build under a separate application ID. Built by the `build-nightly-flatpak` and `publish-nightly-flatpak` jobs in [`tauri-build.yml`](.github/workflows/tauri-build.yml). + ## Android (Obtainium) Android APKs are published to every release, and [Obtainium](https://obtainium.imranr.dev) keeps them updated straight from GitHub. Each release also ships an `obtainium.json` app config. Use it for the nightly channel, where prereleases and date-based version tracking have to be enabled to follow the rolling `nightly` tag. diff --git a/packaging/flatpak/nightly/index.html.in b/packaging/flatpak/nightly/index.html.in new file mode 100644 index 000000000..15a005bfc --- /dev/null +++ b/packaging/flatpak/nightly/index.html.in @@ -0,0 +1,93 @@ + + + + + + Sable Nightly — Flatpak + + + +

Sable Nightly

+

@VERSION@

+ +

+ Rebuilt every night from the development branch, and it breaks. For everyday use, install the + stable release from Flathub. +

+ +

Install

+
flatpak remote-add --if-not-exists sable-nightly @BASE_URL@/sable-nightly.flatpakrepo
+flatpak install sable-nightly moe.sable.client.Nightly
+ +

Update

+
flatpak update moe.sable.client.Nightly
+ +

Uninstall

+
flatpak uninstall moe.sable.client.Nightly
+flatpak remote-delete sable-nightly
+ +

+ Installs alongside the stable build, with separate data. + Source and issues. +

+ + diff --git a/packaging/flatpak/nightly/moe.sable.client.Nightly.desktop b/packaging/flatpak/nightly/moe.sable.client.Nightly.desktop new file mode 100644 index 000000000..9f362d512 --- /dev/null +++ b/packaging/flatpak/nightly/moe.sable.client.Nightly.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Name=Sable Nightly +Comment=Chat over the Matrix network +Exec=sable %U +Icon=moe.sable.client.Nightly +Terminal=false +Categories=Network;InstantMessaging;Chat; +StartupWMClass=sable +MimeType=x-scheme-handler/sable;x-scheme-handler/moe.sable.app; diff --git a/packaging/flatpak/nightly/moe.sable.client.Nightly.metainfo.xml.in b/packaging/flatpak/nightly/moe.sable.client.Nightly.metainfo.xml.in new file mode 100644 index 000000000..6493d1472 --- /dev/null +++ b/packaging/flatpak/nightly/moe.sable.client.Nightly.metainfo.xml.in @@ -0,0 +1,70 @@ + + + moe.sable.client.Nightly + + Sable Nightly + Chat over the Matrix network + + + Sable Maintainers + + + CC0-1.0 + AGPL-3.0-only + + https://sable.moe + https://github.com/SableClient/Sable/issues + https://github.com/SableClient/Sable + + + #b9abfa + #4b3f8f + + + + intense + intense + + + + pointing + keyboard + touch + + + +

+ Nightly builds of Sable, a Matrix client for desktop, with end-to-end + encrypted messaging, spaces, threads, and voice and video calls. +

+

+ These builds come from the development branch and can break at any time. + Install the stable version from Flathub for everyday use. +

+

Features:

+
    +
  • End-to-end encryption with cross-signing and key backup
  • +
  • Spaces, threads, and replies
  • +
  • Voice and video calls
  • +
  • Custom themes
  • +
+
+ + moe.sable.client.Nightly.desktop + + + + https://raw.githubusercontent.com/SableClient/Sable/dev/docs/screenshots/timeline.png + Catching up on a room timeline + + + + + + https://github.com/SableClient/Sable/releases/tag/nightly + +

Rolling nightly build from the development branch

+
+
+
+
diff --git a/packaging/flatpak/nightly/moe.sable.client.Nightly.yml.in b/packaging/flatpak/nightly/moe.sable.client.Nightly.yml.in new file mode 100644 index 000000000..9472d8a08 --- /dev/null +++ b/packaging/flatpak/nightly/moe.sable.client.Nightly.yml.in @@ -0,0 +1,100 @@ +id: moe.sable.client.Nightly + +runtime: org.freedesktop.Platform +runtime-version: '25.08' +sdk: org.freedesktop.Sdk + +base: org.electronjs.Electron2.BaseApp +base-version: '25.08' + +command: sable + +finish-args: + - --socket=x11 + - --share=ipc + - --device=dri + - --share=network + - --socket=pulseaudio + - --device=all + - --talk-name=org.freedesktop.secrets + - --talk-name=org.freedesktop.Notifications + - --talk-name=org.kde.StatusNotifierWatcher + - --filesystem=xdg-download + - --env=XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons + +modules: + - name: xdg-utils + buildsystem: simple + build-commands: + - autoreconf -fi + - ./configure --prefix=${FLATPAK_DEST} + - touch scripts/xdg-mime.txt + - make -C scripts xdg-mime + - install -Dm755 scripts/xdg-mime ${FLATPAK_DEST}/bin/xdg-mime + sources: + - type: git + url: https://gitlab.freedesktop.org/xdg/xdg-utils.git + tag: v1.2.1 + commit: 356c380ad6fecc9ce6bea1f6a77986ba67402c80 + + - name: desktop-file-utils + buildsystem: meson + sources: + - type: archive + url: https://www.freedesktop.org/software/desktop-file-utils/releases/desktop-file-utils-0.28.tar.xz + sha256: 4401d4e231d842c2de8242395a74a395ca468cd96f5f610d822df33594898a70 + + - name: sable + buildsystem: simple + build-commands: + - install -Dm755 apply_extra ${FLATPAK_DEST}/bin/apply_extra + - install -Dm755 sable.sh ${FLATPAK_DEST}/bin/sable + - install -Dm644 LICENSE ${FLATPAK_DEST}/share/licenses/${FLATPAK_ID}/LICENSE + - install -Dm644 moe.sable.client.Nightly.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml + - install -Dm644 moe.sable.client.Nightly.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop + - install -Dm644 32x32.png ${FLATPAK_DEST}/share/icons/hicolor/32x32/apps/${FLATPAK_ID}.png + - install -Dm644 64x64.png ${FLATPAK_DEST}/share/icons/hicolor/64x64/apps/${FLATPAK_ID}.png + - install -Dm644 128x128.png ${FLATPAK_DEST}/share/icons/hicolor/128x128/apps/${FLATPAK_ID}.png + - install -Dm644 256x256.png ${FLATPAK_DEST}/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png + sources: + - type: extra-data + filename: sable.tar.gz + url: https://github.com/SableClient/Sable/releases/download/nightly/Sable-@VERSION@-linux-x86_64.tar.gz + sha256: '@SHA256_X86_64@' + size: @SIZE_X86_64@ + only-arches: [x86_64] + - type: extra-data + filename: sable.tar.gz + url: https://github.com/SableClient/Sable/releases/download/nightly/Sable-@VERSION@-linux-aarch64.tar.gz + sha256: '@SHA256_AARCH64@' + size: @SIZE_AARCH64@ + only-arches: [aarch64] + - type: script + dest-filename: apply_extra + commands: + - set -eu + - mkdir -p sable + - tar --no-same-owner -xzf sable.tar.gz -C sable + - mv sable/runtime/* sable/ + - rmdir sable/runtime + - rm sable.tar.gz + - type: file + path: ../sable.sh + - type: file + path: ../../../LICENSE + - type: file + path: moe.sable.client.Nightly.desktop + - type: file + path: moe.sable.client.Nightly.metainfo.xml + - type: file + path: ../icons/32x32.png + dest-filename: 32x32.png + - type: file + path: ../icons/64x64.png + dest-filename: 64x64.png + - type: file + path: ../icons/128x128.png + dest-filename: 128x128.png + - type: file + path: ../icons/256x256.png + dest-filename: 256x256.png diff --git a/packaging/flatpak/nightly/sable-nightly.flatpakrepo.in b/packaging/flatpak/nightly/sable-nightly.flatpakrepo.in new file mode 100644 index 000000000..96bb4dbd5 --- /dev/null +++ b/packaging/flatpak/nightly/sable-nightly.flatpakrepo.in @@ -0,0 +1,9 @@ +[Flatpak Repo] +Title=Sable Nightly +Url=@REPO_URL@ +Homepage=https://sable.moe +Comment=Nightly builds of the Sable Matrix client +Description=Rolling nightly builds of Sable, straight from the development branch. Expect breakage; install the stable version from Flathub for everyday use. +Icon=https://raw.githubusercontent.com/SableClient/Sable/dev/packaging/flatpak/icons/256x256.png +DefaultBranch=master +GPGKey=@GPGKEY@