From 61fdeb0ec0cc5b7fc775749bc5cd9c76dd869896 Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Fri, 12 Jun 2026 17:32:44 +0200 Subject: [PATCH 1/2] ci: decouple Linux .deb/.rpm publishing from Flatpak The Flatpak maker has failed in CI on every release since v1.9.1, and a maker failure aborts the whole 'electron-forge publish' invocation, so no Linux assets shipped in v1.9.2-v1.9.4. Gate MakerFlatpak behind WCPOS_FLATPAK=1 and attempt the Flatpak as a non-blocking make step with debug output enabled, uploading the bundle to the release only on success. --- .github/workflows/tag-and-release.yml | 68 +++++++++++++++++++---- forge.config.ts | 78 +++++++++++++++------------ 2 files changed, 100 insertions(+), 46 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 11f0294..cc4bec4 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -230,16 +230,6 @@ jobs: rpm \ flatpak flatpak-builder elfutils - # The Flatpak maker builds against the Freedesktop runtime + Electron BaseApp, - # which are pulled from Flathub. Pre-install them so the build is deterministic. - - name: 🐧 Install Flatpak runtime + Electron BaseApp - run: | - flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo - flatpak install -y --user flathub \ - org.freedesktop.Platform//24.08 \ - org.freedesktop.Sdk//24.08 \ - org.electronjs.Electron2.BaseApp//24.08 - - name: 📦 Install and rebuild native modules env: RXDB_PREMIUM: ${{ secrets.RXDB_LICENSE_KEY }} @@ -250,7 +240,63 @@ jobs: npm install npm run rebuild:all - - name: 🚀 Publish Linux release (.deb / .rpm / .flatpak) + # Flatpak is excluded from this step (forge.config.ts only enables the + # Flatpak maker when WCPOS_FLATPAK=1) so a flatpak-builder failure can + # never block the .deb/.rpm assets again. Flatpak is attempted below as + # a non-blocking step. + - name: 🚀 Publish Linux release (.deb / .rpm) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npm run publish-app + + # --- Non-blocking Flatpak attempt below: every step is continue-on-error --- + + # The Flatpak maker builds against the Freedesktop runtime + Electron BaseApp, + # which are pulled from Flathub. Pre-install them so the build is deterministic. + - name: 🐧 Install Flatpak runtime + Electron BaseApp (non-blocking) + id: flatpak-runtime + continue-on-error: true + run: | + flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo + flatpak install -y --user flathub \ + org.freedesktop.Platform//24.08 \ + org.freedesktop.Sdk//24.08 \ + org.electronjs.Electron2.BaseApp//24.08 + + - name: 📦 Make Flatpak bundle (non-blocking) + id: make-flatpak + if: steps.flatpak-runtime.outcome == 'success' + continue-on-error: true + env: + WCPOS_FLATPAK: '1' + # Surface flatpak-builder output — Forge swallows it otherwise, which is + # why past failures only showed "flatpak-builder failed with status code 1". + DEBUG: 'electron-installer-flatpak*' + run: npx electron-forge make --targets=@electron-forge/maker-flatpak --skip-package + + - name: ⬆️ Upload Flatpak to release (non-blocking) + if: steps.make-flatpak.outcome == 'success' + continue-on-error: true + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + version=$(node -p "require('./package.json').version") + files=$(find out/make -name '*.flatpak' -type f) + if [ -z "$files" ]; then + echo "::warning title=Flatpak missing::Flatpak make reported success but no .flatpak file was found under out/make." + exit 0 + fi + echo "$files" | while read -r f; do + echo "Uploading $f to release v$version" + gh release upload "v$version" "$f" --clobber + done + + - name: 📋 Report Flatpak result + if: steps.flatpak-runtime.outcome != 'success' || steps.make-flatpak.outcome != 'success' + run: | + echo "::warning title=Flatpak deferred::The non-blocking Flatpak build did not complete (runtime install: ${{ steps.flatpak-runtime.outcome }}, make: ${{ steps.make-flatpak.outcome }}). .deb/.rpm assets are unaffected. See the 'Make Flatpak bundle' step log (DEBUG output enabled) for the flatpak-builder error." + { + echo "## :warning: Flatpak deferred" + echo "The non-blocking Flatpak build did not complete (runtime install: \`${{ steps.flatpak-runtime.outcome }}\`, make: \`${{ steps.make-flatpak.outcome }}\`)." + echo ".deb/.rpm assets are unaffected." + } >> "$GITHUB_STEP_SUMMARY" diff --git a/forge.config.ts b/forge.config.ts index 7e29a28..323460e 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -157,41 +157,49 @@ const config: ForgeConfig = { ), // Sandboxed Flatpak bundle (also the format published to Flathub) — // https://js.electronforge.io/interfaces/_electron_forge_maker_flatpak.MakerFlatpakConfig.html - new MakerFlatpak( - { - options: { - id: LINUX_APP_ID, - productName: 'WCPOS', - genericName: 'Point of Sale', - // Electron BaseApp + Freedesktop runtime is the recommended pairing for Electron. - // NOTE: confirm these are still the latest non-EOL branches at release time. - base: 'org.electronjs.Electron2.BaseApp', - baseVersion: '24.08', - runtime: 'org.freedesktop.Platform', - runtimeVersion: '24.08', - sdk: 'org.freedesktop.Sdk', - icon: path.resolve(__dirname, 'icons/icon.png'), - categories: ['Office', 'Finance'], - mimeType: ['x-scheme-handler/wcpos'], - // Sandbox permissions. --device=all is required for raw USB receipt printers / - // cash drawers (the `usb` native module); --share=network covers TCP/ESC-POS - // network printers and sync. Keep this in sync with the Flathub manifest. - finishArgs: [ - '--share=ipc', - '--share=network', - '--socket=x11', - '--socket=fallback-x11', - '--socket=wayland', - '--socket=pulseaudio', - '--device=dri', - '--device=all', - '--talk-name=org.freedesktop.Notifications', - '--env=ELECTRON_TRASH=gio', - ], - }, - }, - ['linux'] - ), + // Opt-in via WCPOS_FLATPAK=1: the Flatpak maker has been failing in CI and a + // maker failure aborts the whole `electron-forge publish` run, which blocked + // .deb/.rpm from shipping (no Linux assets since v1.9.1). The publish workflow + // runs deb/rpm by default and attempts the Flatpak in a separate non-blocking step. + ...(process.env.WCPOS_FLATPAK === '1' + ? [ + new MakerFlatpak( + { + options: { + id: LINUX_APP_ID, + productName: 'WCPOS', + genericName: 'Point of Sale', + // Electron BaseApp + Freedesktop runtime is the recommended pairing for Electron. + // NOTE: confirm these are still the latest non-EOL branches at release time. + base: 'org.electronjs.Electron2.BaseApp', + baseVersion: '24.08', + runtime: 'org.freedesktop.Platform', + runtimeVersion: '24.08', + sdk: 'org.freedesktop.Sdk', + icon: path.resolve(__dirname, 'icons/icon.png'), + categories: ['Office', 'Finance'], + mimeType: ['x-scheme-handler/wcpos'], + // Sandbox permissions. --device=all is required for raw USB receipt printers / + // cash drawers (the `usb` native module); --share=network covers TCP/ESC-POS + // network printers and sync. Keep this in sync with the Flathub manifest. + finishArgs: [ + '--share=ipc', + '--share=network', + '--socket=x11', + '--socket=fallback-x11', + '--socket=wayland', + '--socket=pulseaudio', + '--device=dri', + '--device=all', + '--talk-name=org.freedesktop.Notifications', + '--env=ELECTRON_TRASH=gio', + ], + }, + }, + ['linux'] + ), + ] + : []), ], publishers: [ new PublisherGithub({ From 838be6b9597eb25eec27cc8092c990c3cd110dda Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Fri, 12 Jun 2026 17:41:38 +0200 Subject: [PATCH 2/2] ci: install flatpak tooling inside the non-blocking section An apt failure resolving flatpak/flatpak-builder/elfutils in the blocking deps step could still fail publish-linux before the .deb/.rpm publish. Only deb/rpm + native-module prerequisites remain blocking. --- .github/workflows/tag-and-release.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index cc4bec4..0f73be5 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -218,8 +218,10 @@ jobs: with: node-version: 22 - # Build tooling for the makers (.deb -> dpkg/fakeroot, .rpm -> rpm, - # .flatpak -> flatpak/flatpak-builder/eu-strip) plus libudev for the `usb` native module. + # Build tooling for the blocking makers only (.deb -> dpkg/fakeroot, + # .rpm -> rpm) plus libudev for the `usb` native module. Flatpak tooling + # is installed in the non-blocking Flatpak section below so an apt + # failure on those packages can't block the .deb/.rpm publish. - name: 🐧 Install Linux build dependencies run: | sudo apt-get update @@ -227,8 +229,7 @@ jobs: build-essential \ libudev-dev \ dpkg fakeroot \ - rpm \ - flatpak flatpak-builder elfutils + rpm - name: 📦 Install and rebuild native modules env: @@ -251,12 +252,14 @@ jobs: # --- Non-blocking Flatpak attempt below: every step is continue-on-error --- - # The Flatpak maker builds against the Freedesktop runtime + Electron BaseApp, - # which are pulled from Flathub. Pre-install them so the build is deterministic. - - name: 🐧 Install Flatpak runtime + Electron BaseApp (non-blocking) + # Flatpak build tooling (flatpak-builder, eu-strip from elfutils), then the + # Freedesktop runtime + Electron BaseApp pulled from Flathub. Pre-install the + # runtimes so the build is deterministic. + - name: 🐧 Install Flatpak tooling + runtime + Electron BaseApp (non-blocking) id: flatpak-runtime continue-on-error: true run: | + sudo apt-get install -y flatpak flatpak-builder elfutils flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo flatpak install -y --user flathub \ org.freedesktop.Platform//24.08 \