Skip to content

Commit c3be52f

Browse files
authored
Add Linux AppImage build process for CI (#309)
1 parent 7fad522 commit c3be52f

File tree

5 files changed

+83
-0
lines changed

5 files changed

+83
-0
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ jobs:
9292
with:
9393
name: tiddlydesktop-${{ matrix.platform-for-pkg }}-v${{ steps.td-version.outputs.version }}.zip
9494
path: output/tiddlydesktop-${{ matrix.platform-for-pkg }}-v${{ steps.td-version.outputs.version }}.zip
95+
- name: "📤 Uploading Linux AppImage packages..."
96+
uses: actions/upload-artifact@v4
97+
if: matrix.platform == 'linux'
98+
with:
99+
name: tiddlydesktop-${{ matrix.platform-for-pkg }}-v${{ steps.td-version.outputs.version }}.AppImage
100+
path: output/tiddlydesktop-${{ matrix.platform-for-pkg }}-v${{ steps.td-version.outputs.version }}.AppImage
95101
outputs:
96102
td-version: ${{ steps.td-version.outputs.version }}
97103

@@ -115,3 +121,4 @@ jobs:
115121
draft: true
116122
files: |
117123
tiddlydesktop-*-v${{ needs.build-and-package.outputs.td-version }}.zip
124+
tiddlydesktop-*-v${{ needs.build-and-package.outputs.td-version }}.AppImage

bld.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,49 @@ cp -RH nwjs/nwjs-sdk-v${NWJS_VERSION}-linux-ia32/* output/linux32/TiddlyDesktop-
101101
cp -RH source/* output/linux32/TiddlyDesktop-linux32-v$(./bin/get-version-number)
102102
}
103103

104+
# # Linux AppImage
105+
# # For Github CI, only
106+
build_linux_appimage() {
107+
appdir="output/AppDir.$ARCH"
108+
build_dependencies="curl findutils desktop-file-utils"
109+
font_packages="fonts-dejavu-core fonts-dejavu-extra"
110+
runtime_dependencies="$font_packages libnss3 libnspr4 libasound2-dev libatomic1 libatk1.0-0 libcups2-dev libxkbcommon-dev libatspi2.0-dev libxcomposite-dev libxdamage-dev libxfixes-dev libxrandr-dev libpango1.0-dev libgbm-dev libcairo2-dev libxi-dev libxrender-dev libwayland-dev libfribidi-dev libthai-dev libharfbuzz-dev libpng-dev libfontconfig-dev libfreetype-dev libpixman-1-dev libdatrie-dev libgraphite2-dev libbz2-dev fonts-dejavu"
111+
package_arch=""
112+
appimagetool_arch=""
113+
sudo apt-get install -y $runtime_dependencies $build_dependencies
114+
115+
case "$ARCH" in
116+
ia32)
117+
package_arch="linux32"
118+
appimagetool_arch="i686"
119+
curl -L https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-i686.AppImage -o output/appimagetool-$ARCH.AppImage
120+
;;
121+
x64)
122+
package_arch="linux64"
123+
appimagetool_arch="x86_64"
124+
curl -L https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -o output/appimagetool-$ARCH.AppImage
125+
;;
126+
esac
127+
128+
chmod u+x output/appimagetool-$ARCH.AppImage
129+
mkdir -p $appdir
130+
mkdir -p $appdir/usr/{bin,lib,share}
131+
mkdir -p $appdir/usr/share/fonts/truetype/dejavu
132+
cp icons/app-icon1024.png $appdir/tiddlydesktop.png
133+
cp linux/AppRun $appdir/
134+
cp linux/tiddlydesktop.desktop $appdir/
135+
cp -r output/$package_arch/TiddlyDesktop-$package_arch-v$(./bin/get-version-number)/* $appdir/usr/bin/
136+
137+
libraries=$(dpkg -L $runtime_dependencies | grep "\.so" 2>/dev/null)
138+
for f in $libraries; do
139+
cp $f* $appdir/usr/lib/
140+
done
141+
142+
dpkg -L $font_packages | grep "\.ttf" 2>/dev/null | xargs -I '{}' -- cp '{}' $appdir/usr/share/fonts/truetype/dejavu/
143+
VERSION=$(./bin/get-version-number)
144+
ARCH=$appimagetool_arch ./output/appimagetool-$ARCH.AppImage --no-appstream $appdir output/tiddlydesktop-$package_arch-v$(./bin/get-version-number).AppImage
145+
}
146+
104147
if [ "$CI" = "true" ]; then
105148
# Running in GitHub Actions, where each platform builds as a separate step, in parallel, with PLATFORM and ARCH variables supplied by the GitHub Actions script
106149
case "$PLATFORM-$ARCH" in
@@ -118,9 +161,11 @@ if [ "$CI" = "true" ]; then
118161
;;
119162
linux-ia32)
120163
build_linux32
164+
build_linux_appimage
121165
;;
122166
linux-x64)
123167
build_linux64
168+
build_linux_appimage
124169
;;
125170
esac
126171
else

linux/AppRun

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
SELF=$(readlink -f "$0")
3+
HERE=${SELF%/*}
4+
export PATH="${HERE}/usr/bin/:${HERE}/usr/sbin/:${HERE}/usr/games/:${HERE}/bin/:${HERE}/sbin/${PATH:+:$PATH}"
5+
export LD_LIBRARY_PATH="${HERE}/usr/lib/:${HERE}/usr/lib/i386-linux-gnu/:${HERE}/usr/lib/x86_64-linux-gnu/:${HERE}/usr/lib32/:${HERE}/usr/lib64/:${HERE}/lib/:${HERE}/lib/i386-linux-gnu/:${HERE}/lib/x86_64-linux-gnu/:${HERE}/lib32/:${HERE}/lib64/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
6+
export PYTHONPATH="${HERE}/usr/share/pyshared/${PYTHONPATH:+:$PYTHONPATH}"
7+
export XDG_DATA_DIRS="${HERE}/usr/share/${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
8+
export PERLLIB="${HERE}/usr/share/perl5/:${HERE}/usr/lib/perl5/${PERLLIB:+:$PERLLIB}"
9+
export GSETTINGS_SCHEMA_DIR="${HERE}/usr/share/glib-2.0/schemas/${GSETTINGS_SCHEMA_DIR:+:$GSETTINGS_SCHEMA_DIR}"
10+
export QT_PLUGIN_PATH="${HERE}/usr/lib/qt4/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt4/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt4/plugins/:${HERE}/usr/lib32/qt4/plugins/:${HERE}/usr/lib64/qt4/plugins/:${HERE}/usr/lib/qt5/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt5/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt5/plugins/:${HERE}/usr/lib32/qt5/plugins/:${HERE}/usr/lib64/qt5/plugins/${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
11+
EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1)
12+
exec "${EXEC}" "$@"

linux/tiddlydesktop.desktop

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Desktop Entry]
2+
Categories=Utility;TextEditor
3+
Exec=nw
4+
Icon=tiddlydesktop
5+
Name=Tiddly Desktop
6+
Type=Application
7+
Version=1.4

readme.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ Unzip into a folder and run `TiddlyWiki.app` or `nw.exe` and for linux `nw`
2020

2121
Note that TiddlyDesktop will not work correctly from a Windows UNC network share (eg ``\\MY-SERVER\SHARE\MyFolder``). You should map the network share to a local drive, and run it from there.
2222

23+
## Linux AppImage
24+
25+
Linux releases are also available in the AppImage format. The AppImages are compatible with glibc-based Desktop Linux distributions such as Ubuntu, Fedora, and Arch Linux. The AppImages are _not_ compatible with musl-based Linux distributions such as Alpine Linux, nor are they compatible with Linux server distributions; Server distributions don't provide enough of the required dependencies.
26+
27+
To use an AppImage, your Linux distribution must provide `fusermount3`, which is typically provided in a package named `fuse3`.
28+
29+
Before you can execute an AppImage, you must set the executable permission:
30+
31+
```
32+
chmod u+x tiddlydesktop-*-v*.AppImage
33+
```
34+
2335
## NixOS
2436

2537
To install TiddlyDesktop on NixOS, you first need to add this repo to your `configuration.nix`; Using a `let` expression at the top of the file is a good approach:

0 commit comments

Comments
 (0)