Skip to content

Commit 2c57aea

Browse files
committed
Add flatpak build action
1 parent 8357a02 commit 2c57aea

6 files changed

Lines changed: 236 additions & 1 deletion

.github/workflows/android.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,43 @@ jobs:
323323
name: appimage-package
324324
path: LinuxCommandLibrary-*.AppImage
325325

326+
flatpak:
327+
name: Generate Flatpak
328+
needs: [linux-tar]
329+
runs-on: ubuntu-latest
330+
steps:
331+
- name: Checkout
332+
uses: actions/checkout@v4
333+
- name: Download Linux Tarball
334+
uses: actions/download-artifact@v4
335+
with:
336+
name: linux-tar-package
337+
- name: Install Flatpak and Builder
338+
run: |
339+
sudo apt-get update
340+
sudo apt-get install -y flatpak flatpak-builder
341+
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
342+
sudo flatpak install -y flathub org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08
343+
- name: Build Flatpak
344+
run: |
345+
# Copy tarball to flatpak dir and compute sha256
346+
cp LinuxCommandLibrary-linux-x86_64.tar.gz flatpak/
347+
SHA256=$(sha256sum LinuxCommandLibrary-linux-x86_64.tar.gz | cut -d' ' -f1)
348+
349+
# Patch manifest to use local tarball instead of URL
350+
cd flatpak
351+
sed -i "s|url: https://github.com/SimonSchubert/LinuxCommandLibrary/releases/download/.*|path: LinuxCommandLibrary-linux-x86_64.tar.gz|" io.github.simonschubert.LinuxCommandLibrary.yaml
352+
sed -i "s|sha256: .*|sha256: ${SHA256}|" io.github.simonschubert.LinuxCommandLibrary.yaml
353+
354+
# Build and bundle
355+
flatpak-builder --repo=repo --force-clean build-dir io.github.simonschubert.LinuxCommandLibrary.yaml
356+
flatpak build-bundle repo ../LinuxCommandLibrary.flatpak io.github.simonschubert.LinuxCommandLibrary
357+
- name: Upload Flatpak Artifact
358+
uses: actions/upload-artifact@v4
359+
with:
360+
name: flatpak-package
361+
path: LinuxCommandLibrary.flatpak
362+
326363
play-store:
327364
name: Upload AAB to Play Store
328365
runs-on: ubuntu-latest
@@ -379,7 +416,7 @@ jobs:
379416

380417
release:
381418
name: Release All Platforms
382-
needs: [apk, cli-linux, cli-macos, cli-windows, dmg, msi, deb, rpm, appimage, linux-tar]
419+
needs: [apk, cli-linux, cli-macos, cli-windows, dmg, msi, deb, rpm, appimage, linux-tar, flatpak]
383420
runs-on: ubuntu-latest
384421
steps:
385422
- name: Checkout
@@ -447,6 +484,11 @@ jobs:
447484
with:
448485
name: linux-tar-package
449486

487+
- name: Download Flatpak Artifact
488+
uses: actions/download-artifact@v4
489+
with:
490+
name: flatpak-package
491+
450492
- name: List downloaded files (for debugging)
451493
run: ls -la
452494

@@ -480,6 +522,7 @@ jobs:
480522
mv *.rpm "LinuxCommandLibrary-${VERSION}-linux.rpm"
481523
mv *.AppImage "LinuxCommandLibrary-${VERSION}-linux.AppImage"
482524
mv LinuxCommandLibrary-linux-x86_64.tar.gz "LinuxCommandLibrary-${VERSION}-linux-x86_64.tar.gz"
525+
mv LinuxCommandLibrary.flatpak "LinuxCommandLibrary-${VERSION}-linux.flatpak"
483526
484527
- name: Create Github Release
485528
uses: softprops/action-gh-release@v2

.github/workflows/flatpak.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Flatpak Manifest
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build and Release"]
6+
types: [completed]
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
update:
13+
name: Update Flatpak Manifest
14+
if: github.event.workflow_run.conclusion == 'success'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Get version from release
21+
id: version
22+
run: echo "version=$(echo '${{ github.event.workflow_run.head_branch }}' | sed 's/^v//')" >> $GITHUB_OUTPUT
23+
24+
- name: Update manifest version and checksum
25+
run: |
26+
VERSION="${{ steps.version.outputs.version }}"
27+
TARBALL_URL="https://github.com/SimonSchubert/LinuxCommandLibrary/releases/download/v${VERSION}/LinuxCommandLibrary-${VERSION}-linux-x86_64.tar.gz"
28+
29+
# Download tarball and compute SHA256
30+
curl -L -o tarball.tar.gz "$TARBALL_URL"
31+
SHA256=$(sha256sum tarball.tar.gz | cut -d' ' -f1)
32+
rm tarball.tar.gz
33+
34+
# Update manifest
35+
cd flatpak
36+
sed -i "s|url: https://github.com/SimonSchubert/LinuxCommandLibrary/releases/download/.*|url: ${TARBALL_URL}|" io.github.simonschubert.LinuxCommandLibrary.yaml
37+
sed -i "s|sha256: .*|sha256: ${SHA256}|" io.github.simonschubert.LinuxCommandLibrary.yaml
38+
39+
echo "Updated manifest to version ${VERSION} with sha256 ${SHA256}"
40+
41+
- name: Push changes
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
run: |
45+
VERSION="${{ steps.version.outputs.version }}"
46+
git config user.name "github-actions[bot]"
47+
git config user.email "github-actions[bot]@users.noreply.github.com"
48+
49+
git add flatpak/io.github.simonschubert.LinuxCommandLibrary.yaml
50+
git commit -m "Update Flatpak manifest to ${VERSION}" || exit 0
51+
git pull --rebase origin master
52+
git push

flatpak/flathub.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"only-arches": ["x86_64"]
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Desktop Entry]
2+
Name=Linux Command Library
3+
Comment=Linux command reference and cheat sheets
4+
Exec=lcl-gui-wrapper
5+
Icon=io.github.simonschubert.LinuxCommandLibrary
6+
Type=Application
7+
Categories=Utility;
8+
Keywords=Linux;Command;Terminal;Reference;Cheatsheet;
9+
StartupWMClass=compose-window
10+
Terminal=false
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop-application">
3+
<id>io.github.simonschubert.LinuxCommandLibrary</id>
4+
5+
<name>Linux Command Library</name>
6+
<summary>Linux command reference and cheat sheets</summary>
7+
8+
<metadata_license>CC0-1.0</metadata_license>
9+
<project_license>Apache-2.0</project_license>
10+
11+
<developer id="io.github.simonschubert">
12+
<name>Simon Schubert</name>
13+
</developer>
14+
15+
<description>
16+
<p>
17+
Linux Command Library is an offline reference for Linux commands and terminal tips.
18+
It currently ships thousands of manual pages, dozens of basic categories, and a
19+
collection of general terminal tips. It works 100% offline, needs no internet
20+
connection, and has no tracking.
21+
</p>
22+
<p>Features:</p>
23+
<ul>
24+
<li>Thousands of Linux manual pages, available offline</li>
25+
<li>Categorized cheat sheets and general terminal tips</li>
26+
<li>Full-text search across commands and tips</li>
27+
<li>Bookmark frequently used commands</li>
28+
<li>Available on Android, iOS, Desktop, CLI, and Web</li>
29+
</ul>
30+
</description>
31+
32+
<launchable type="desktop-id">io.github.simonschubert.LinuxCommandLibrary.desktop</launchable>
33+
34+
<url type="homepage">https://linuxcommandlibrary.com</url>
35+
<url type="bugtracker">https://github.com/SimonSchubert/LinuxCommandLibrary/issues</url>
36+
<url type="vcs-browser">https://github.com/SimonSchubert/LinuxCommandLibrary</url>
37+
38+
<branding>
39+
<color type="primary" scheme_preference="light">#eceff1</color>
40+
<color type="primary" scheme_preference="dark">#263238</color>
41+
</branding>
42+
43+
<screenshots>
44+
<screenshot type="default">
45+
<caption>Desktop overview</caption>
46+
<image>https://raw.githubusercontent.com/SimonSchubert/LinuxCommandLibrary/master/art/screen-desktop-1.png</image>
47+
</screenshot>
48+
<screenshot>
49+
<caption>Command detail view</caption>
50+
<image>https://raw.githubusercontent.com/SimonSchubert/LinuxCommandLibrary/master/art/screen-desktop-2.png</image>
51+
</screenshot>
52+
</screenshots>
53+
54+
<content_rating type="oars-1.1" />
55+
56+
<supports>
57+
<control>pointing</control>
58+
<control>keyboard</control>
59+
</supports>
60+
61+
<releases>
62+
<release version="3.7.6" date="2026-04-14">
63+
<url type="details">https://github.com/SimonSchubert/LinuxCommandLibrary/releases/tag/v3.7.6</url>
64+
</release>
65+
</releases>
66+
</component>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
app-id: io.github.simonschubert.LinuxCommandLibrary
2+
runtime: org.freedesktop.Platform
3+
runtime-version: '24.08'
4+
sdk: org.freedesktop.Sdk
5+
command: lcl-gui-wrapper
6+
7+
finish-args:
8+
- --socket=x11
9+
- --socket=wayland
10+
- --share=ipc
11+
- --device=dri
12+
- --persist=.linuxcommandlibrary
13+
- --persist=.java
14+
15+
modules:
16+
- name: linuxcommandlibrary
17+
buildsystem: simple
18+
build-commands:
19+
# Extract and install the application
20+
- tar xf LinuxCommandLibrary-linux-x86_64.tar.gz
21+
- mkdir -p /app/lib/linuxcommandlibrary
22+
- cp -r LinuxCommandLibrary/* /app/lib/linuxcommandlibrary/
23+
24+
# Install wrapper script
25+
- install -Dm755 lcl-gui-wrapper.sh /app/bin/lcl-gui-wrapper
26+
27+
# Install desktop file
28+
- install -Dm644 io.github.simonschubert.LinuxCommandLibrary.desktop /app/share/applications/io.github.simonschubert.LinuxCommandLibrary.desktop
29+
30+
# Install metainfo
31+
- install -Dm644 io.github.simonschubert.LinuxCommandLibrary.metainfo.xml /app/share/metainfo/io.github.simonschubert.LinuxCommandLibrary.metainfo.xml
32+
33+
# Install icon
34+
- install -Dm644 icon.png /app/share/icons/hicolor/512x512/apps/io.github.simonschubert.LinuxCommandLibrary.png
35+
36+
sources:
37+
- type: file
38+
url: https://github.com/SimonSchubert/LinuxCommandLibrary/releases/download/v3.7.6/LinuxCommandLibrary-3.7.6-linux-x86_64.tar.gz
39+
sha256: b3523601d0525be75634f5cb82aa4bd8cbc0964a7008ce8781e648a38ae4d560
40+
dest-filename: LinuxCommandLibrary-linux-x86_64.tar.gz
41+
x-checker-data:
42+
type: json
43+
url: https://api.github.com/repos/SimonSchubert/LinuxCommandLibrary/releases/latest
44+
version-query: .tag_name | sub("^v"; "")
45+
url-query: .assets[] | select(.name | test("linux-x86_64\\.tar\\.gz$")) | .browser_download_url
46+
47+
- type: file
48+
path: io.github.simonschubert.LinuxCommandLibrary.desktop
49+
50+
- type: file
51+
path: io.github.simonschubert.LinuxCommandLibrary.metainfo.xml
52+
53+
- type: file
54+
path: ../desktopApp/icon.png
55+
56+
- type: script
57+
dest-filename: lcl-gui-wrapper.sh
58+
commands:
59+
- export PATH="/app/lib/linuxcommandlibrary/bin:${PATH}"
60+
- export LD_LIBRARY_PATH="/app/lib/linuxcommandlibrary/lib/runtime/lib:${LD_LIBRARY_PATH}"
61+
- exec /app/lib/linuxcommandlibrary/bin/LinuxCommandLibrary "$@"

0 commit comments

Comments
 (0)