feat(flatpak): add script to ensure Flathub remote exists and update build process for Electron Forge

This commit is contained in:
Ivan committed 2026-04-22 18:16:52 -05:00
1 parent ef977c84b3
commit f193010f37
5 files changed
+49 -2

No files matched your search

+3 -2
View File
@@ -21,6 +21,8 @@ on:
paths:
- "package.json"
- "forge.config.js"
- "scripts/electron-forge-local-tmp.js"
- "scripts/ensure-flatpak-flathub-remote.sh"
- "scripts/ci/github-build-linux-*.sh"
- ".github/workflows/build-linux-packages.yml"
- ".github/workflows/frontend-build.yml"
@@ -80,8 +82,7 @@ jobs:
- name: Install flatpak runtimes (user scope)
run: |
set -euo pipefail
flatpak --user remote-add --if-not-exists flathub \
https://flathub.org/repo/flathub.flatpakrepo
bash scripts/ensure-flatpak-flathub-remote.sh
flatpak --user install -y --noninteractive flathub \
org.freedesktop.Platform//25.08 \
org.freedesktop.Sdk//25.08 \
+16
View File
@@ -84,6 +84,22 @@ module.exports = {
config: {
options: {
categories: ["Network"],
// electron-installer-flatpak still defaults to zypak v2021.02, which hardcodes
// clang++; org.freedesktop.Sdk 25.08 does not ship clang++ on PATH. Match
// org.electronjs.Electron2.BaseApp 25.08 (g++ / C++20).
modules: [
{
name: "zypak",
sources: [
{
type: "git",
url: "https://github.com/refi64/zypak",
tag: "v2025.09",
commit: "693a71c5ffa80ec9c9ce2ae03b1ccc493c698e53",
},
],
},
],
runtime: "org.freedesktop.Platform",
runtimeVersion: "25.08",
sdk: "org.freedesktop.Sdk",
+2
View File
@@ -9,6 +9,8 @@
# - flatpak, flatpak-builder, elfutils (for eu-strip)
# - org.freedesktop.Platform/Sdk//25.08
# - org.electronjs.Electron2.BaseApp//25.08
# ``electron-forge-local-tmp.js`` registers the Flathub user remote before Forge so
# ``@malept/flatpak-bundler`` can auto-install those refs when missing.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
+16
View File
@@ -20,6 +20,22 @@ const env = {
const forgeCli = require.resolve("@electron-forge/cli/dist/electron-forge.js");
const args = process.argv.slice(2);
const flatpakForgeTarget =
args.includes("@electron-forge/maker-flatpak") ||
process.env.FORGE_MAKE_FLATPAK === "1" ||
process.env.FORGE_MAKE_FLATPAK === "true";
if (flatpakForgeTarget) {
const ensure = path.join(root, "scripts", "ensure-flatpak-flathub-remote.sh");
const pre = spawnSync("bash", [ensure], { cwd: root, stdio: "inherit" });
if (pre.status !== 0 && pre.status !== null) {
process.exit(pre.status);
}
if (pre.signal) {
process.exit(1);
}
}
const result = spawnSync(process.execPath, [forgeCli, ...args], {
cwd: root,
env,
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# flatpak-bundler installs runtimes with flatpak --user and a bare ref; that only works
# once the Flathub remote exists (see @malept/flatpak-bundler ensureRef).
set -euo pipefail
if ! command -v flatpak >/dev/null 2>&1; then
echo "flatpak is not installed." >&2
exit 1
fi
flatpak --user remote-add --if-not-exists flathub \
https://flathub.org/repo/flathub.flatpakrepo