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.
This commit is contained in:
Erwan Leboucher committed 2026-08-26 10:33:10 +02:00
1 parent 09736f8bab
commit 223de87fb9
9 files changed
+575 -3

No files matched your search

@@ -0,0 +1,84 @@
#!/usr/bin/env node
/* oxlint-disable no-console */
// Usage: render-flatpak-nightly.mjs <version> <x86_64-sha256:size> <aarch64-sha256:size> [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 <version> <x86_64-sha256:size> <aarch64-sha256:size> [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})`);
+196 -3
View File
@@ -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]
+4
View File
@@ -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
+9
View File
@@ -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.
+93
View File
@@ -0,0 +1,93 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Sable Nightly — Flatpak</title>
<style>
:root {
color-scheme: light dark;
--bg: #ffffff;
--fg: #1a1c28;
--muted: #5b5f74;
--accent: #4b3f8f;
--code-bg: #f2f1f8;
--border: #dedce9;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #14151d;
--fg: #eceaf5;
--muted: #a09fb4;
--accent: #b9abfa;
--code-bg: #1e1f2b;
--border: #2c2d3c;
}
}
body {
margin: 0 auto;
padding: 3rem 1.25rem 5rem;
max-width: 44rem;
background: var(--bg);
color: var(--fg);
font:
16px/1.6 system-ui,
sans-serif;
}
h1 {
margin: 0 0 0.25rem;
font-size: 1.9rem;
}
.version {
color: var(--muted);
font-family: ui-monospace, monospace;
font-size: 0.9rem;
}
h2 {
margin-top: 2.5rem;
font-size: 1.15rem;
}
pre {
overflow-x: auto;
padding: 0.85rem 1rem;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--code-bg);
font-size: 0.9rem;
}
a {
color: var(--accent);
}
.warn {
border-left: 3px solid var(--accent);
padding-left: 1rem;
color: var(--muted);
}
</style>
</head>
<body>
<h1>Sable Nightly</h1>
<p class="version">@VERSION@</p>
<p class="warn">
Rebuilt every night from the development branch, and it breaks. For everyday use, install the
stable release from <a href="https://flathub.org/apps/moe.sable.client">Flathub</a>.
</p>
<h2>Install</h2>
<pre><code>flatpak remote-add --if-not-exists sable-nightly @BASE_URL@/sable-nightly.flatpakrepo
flatpak install sable-nightly moe.sable.client.Nightly</code></pre>
<h2>Update</h2>
<pre><code>flatpak update moe.sable.client.Nightly</code></pre>
<h2>Uninstall</h2>
<pre><code>flatpak uninstall moe.sable.client.Nightly
flatpak remote-delete sable-nightly</code></pre>
<p>
Installs alongside the stable build, with separate data.
<a href="https://github.com/SableClient/Sable">Source and issues</a>.
</p>
</body>
</html>
@@ -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;
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>moe.sable.client.Nightly</id>
<name>Sable Nightly</name>
<summary>Chat over the Matrix network</summary>
<developer id="moe.sable">
<name>Sable Maintainers</name>
</developer>
<metadata_license>CC0-1.0</metadata_license>
<project_license>AGPL-3.0-only</project_license>
<url type="homepage">https://sable.moe</url>
<url type="bugtracker">https://github.com/SableClient/Sable/issues</url>
<url type="vcs-browser">https://github.com/SableClient/Sable</url>
<branding>
<color type="primary" scheme_preference="light">#b9abfa</color>
<color type="primary" scheme_preference="dark">#4b3f8f</color>
</branding>
<content_rating type="oars-1.1">
<content_attribute id="social-chat">intense</content_attribute>
<content_attribute id="social-audio">intense</content_attribute>
</content_rating>
<supports>
<control>pointing</control>
<control>keyboard</control>
<control>touch</control>
</supports>
<description>
<p>
Nightly builds of Sable, a Matrix client for desktop, with end-to-end
encrypted messaging, spaces, threads, and voice and video calls.
</p>
<p>
These builds come from the development branch and can break at any time.
Install the stable version from Flathub for everyday use.
</p>
<p>Features:</p>
<ul>
<li>End-to-end encryption with cross-signing and key backup</li>
<li>Spaces, threads, and replies</li>
<li>Voice and video calls</li>
<li>Custom themes</li>
</ul>
</description>
<launchable type="desktop-id">moe.sable.client.Nightly.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/SableClient/Sable/dev/docs/screenshots/timeline.png</image>
<caption>Catching up on a room timeline</caption>
</screenshot>
</screenshots>
<releases>
<release version="@VERSION@" date="@DATE@">
<url type="details">https://github.com/SableClient/Sable/releases/tag/nightly</url>
<description>
<p>Rolling nightly build from the development branch</p>
</description>
</release>
</releases>
</component>
@@ -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-@[email protected]
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
@@ -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@