Skip to content

Commit 208487c

Browse files
committed
feat: add linux flatpack build
1 parent 33ffde2 commit 208487c

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

.github/workflows/ubuntu.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ jobs:
5454
- name: Install linux dependencies
5555
run: |
5656
sudo apt-get update
57-
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
57+
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf flatpak flatpak-builder
58+
flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
59+
flatpak install --user -y --noninteractive org.freedesktop.Platform//25.08 org.freedesktop.Sdk//25.08 org.electronjs.Electron2.BaseApp//25.08
5860
5961
- name: Install Dependencies
6062
uses: nick-fields/retry@v3

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,25 @@ Maybe you only want to execute the application in the browser with hot reload? J
112112

113113
**Your application is optimised. Only /dist folder and NodeJS dependencies are included in the final bundle.**
114114

115+
## Building Flatpak (Linux)
116+
117+
On Linux, `npm run electron:build` produces both an AppImage and a Flatpak. The Flatpak build requires additional tooling:
118+
119+
``` bash
120+
# Install flatpak and flatpak-builder
121+
sudo apt install flatpak flatpak-builder
122+
123+
# Add the Flathub remote
124+
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
125+
126+
# Install the required runtimes
127+
flatpak install flathub org.freedesktop.Platform//25.08
128+
flatpak install flathub org.freedesktop.Sdk//25.08
129+
flatpak install flathub org.electronjs.Electron2.BaseApp//25.08
130+
```
131+
132+
Once the runtimes are installed, `npm run electron:build` will generate the Flatpak bundle alongside the AppImage in the `release/` folder.
133+
115134
## You want to use a specific lib (like rxjs) in electron main thread ?
116135

117136
YES! You can do it! Just by importing your library in npm dependencies section of `app/package.json` with `npm install --save XXXXX`. \

electron-builder.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,29 @@
3232
"linux": {
3333
"icon": "dist/browser/assets/icons",
3434
"target": [
35-
"AppImage"
35+
"AppImage",
36+
{
37+
"target": "flatpak",
38+
"arch": ["x64"]
39+
}
40+
]
41+
},
42+
"flatpak": {
43+
"category": "Utility",
44+
"base": "org.electronjs.Electron2.BaseApp",
45+
"baseVersion": "25.08",
46+
"runtime": "org.freedesktop.Platform",
47+
"runtimeVersion": "25.08",
48+
"sdk": "org.freedesktop.Sdk",
49+
"finishArgs": [
50+
"--socket=wayland",
51+
"--socket=x11",
52+
"--share=ipc",
53+
"--device=dri",
54+
"--socket=pulseaudio",
55+
"--filesystem=home",
56+
"--share=network",
57+
"--talk-name=org.freedesktop.Notifications"
3658
]
3759
}
3860
}

0 commit comments

Comments
 (0)