fix(flatpak): add metainfo releases on prepare-release and pin Flathub sources to the tag

This commit is contained in:
Erwan Leboucher committed 2026-09-24 15:34:00 +02:00
1 parent 2e09cf3edc
commit 6cb735778f
4 files changed
+54 -4

No files matched your search

+5 -4
View File
@@ -1232,9 +1232,9 @@ jobs:
--jq '.assets[] | select(.name | test("-linux-(x86_64|aarch64)\\.tar\\.gz$"))
| "\(.name) \(.digest)"' > assets.txt
# The manifest pins these two by content, read from dev.
# The manifest pins these two by content, read from the release tag.
for name in moe.sable.client.metainfo.xml moe.sable.client.desktop; do
curl -fsSL "https://raw.githubusercontent.com/SableClient/Sable/dev/packaging/flatpak/$name" \
curl -fsSL "https://raw.githubusercontent.com/SableClient/Sable/${TAG}/packaging/flatpak/$name" \
| sha256sum | awk -v n="$name" '{print n, "sha256:" $1}' >> assets.txt
done
@@ -1261,9 +1261,10 @@ jobs:
sys.exit(f"expected one {arch} source, found {count}")
for name in ("moe.sable.client.metainfo.xml", "moe.sable.client.desktop"):
url = f"https://raw.githubusercontent.com/SableClient/Sable/v{version}/packaging/flatpak/{name}"
text, count = re.subn(
rf"(url: \S*/packaging/flatpak/{re.escape(name)}\n\s+)sha256: \w+",
lambda m: f"{m.group(1)}sha256: {sha[name]}",
rf"url: \S*/packaging/flatpak/{re.escape(name)}\n(\s+)sha256: \w+",
lambda m: f"url: {url}\n{m.group(1)}sha256: {sha[name]}",
text,
)
if count != 1:
+5
View File
@@ -43,6 +43,11 @@ type = "PrepareRelease"
type = "Command"
command = "node scripts/fastlane-changelog.js $version && git add fastlane/metadata/android/en-US/changelogs"
# Flathub reads the metainfo from the tagged commit for the same reason.
[[workflows.steps]]
type = "Command"
command = "node scripts/flatpak-metainfo-release.js $version && git add packaging/flatpak/moe.sable.client.metainfo.xml"
[[workflows.steps]]
type = "Command"
command = "git commit -m \"chore: prepare release $version\""
@@ -56,6 +56,12 @@
</screenshots>
<releases>
<release version="1.22.6" date="2026-09-20">
<url type="details">https://github.com/SableClient/Sable/releases/tag/v1.22.6</url>
</release>
<release version="1.22.5" date="2026-09-20">
<url type="details">https://github.com/SableClient/Sable/releases/tag/v1.22.5</url>
</release>
<release version="1.22.4" date="2026-09-18">
<url type="details">https://github.com/SableClient/Sable/releases/tag/v1.22.4</url>
</release>
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env node
//MISE hide=true
//MISE description="Add the current version to the Flatpak metainfo releases"
/* oxlint-disable no-console */
import { readFileSync, writeFileSync } from 'node:fs';
import process from 'node:process';
const version = process.argv[2];
if (!version || !/^\d+\.\d+\.\d+/.test(version)) {
console.error(
`Usage: node scripts/flatpak-metainfo-release.js <version> (got: ${version ?? '<none>'})`
);
process.exit(1);
}
const changelog = readFileSync('CHANGELOG.md', 'utf8');
const date = changelog.match(
new RegExp(`\\n## ${version.replaceAll('.', '\\.')} \\((\\d{4}-\\d{2}-\\d{2})\\)`)
)?.[1];
if (!date) {
console.error(`No "## ${version} (YYYY-MM-DD)" section in CHANGELOG.md`);
process.exit(1);
}
const path = 'packaging/flatpak/moe.sable.client.metainfo.xml';
const metainfo = readFileSync(path, 'utf8');
if (metainfo.includes(`<release version="${version}"`)) {
console.log(`${path} already lists ${version}`);
process.exit(0);
}
const entry = ` <release version="${version}" date="${date}">
<url type="details">https://github.com/SableClient/Sable/releases/tag/v${version}</url>
</release>
`;
writeFileSync(path, metainfo.replace(' <releases>\n', ` <releases>\n${entry}`));
console.log(`Added ${version} to ${path}`);