Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Add AppImage #1391

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,42 @@ jobs:
runs-on: ubuntu-latest
container:
image: ghcr.io/dunst-project/docker-images:misc-doxygen

appimage:
runs-on: ubuntu-latest
container: alpine:latest
steps:
- uses: actions/checkout@v4

- name: build appimage
if: always()
run: |
apk add \
build-base \
dbus \
dbus-dev \
desktop-file-utils \
git \
libnotify-dev \
librsvg \
libxinerama-dev \
libxrandr-dev \
libxscrnsaver-dev \
pango-dev \
patchelf \
perl \
wayland-dev \
wayland-protocols \
wget

chmod +x ./AppImage/make-appimage.sh
./AppImage/make-appimage.sh

mkdir dist
mv *.AppImage dist/

- name: Upload appimage artifact
uses: actions/[email protected]
with:
name: AppImage
path: 'dist'
99 changes: 99 additions & 0 deletions AppImage/make-appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/bin/sh
bebehei marked this conversation as resolved.
Show resolved Hide resolved

# This script is meant to be ran on alpine linux, dependencies:
# wget build-base patchelf libxscrnsaver-dev libxinerama-dev libxrandr-dev libnotify-dev
# dbus-dev wayland-dev perl pango-dev wayland-protocols dbus librsvg desktop-file-utils

set -e
export ARCH="$(uname -m)"
bebehei marked this conversation as resolved.
Show resolved Hide resolved
export APPIMAGE_EXTRACT_AND_RUN=1
APPIMAGETOOL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage"
export COMPLETIONS=0

# BUILD DUNST
mkdir -p ./AppDir
make -j$(nproc) PREFIX="$PWD"/AppDir/usr
make install PREFIX="$PWD"/AppDir/usr
cd ./AppDir

# AppRun
echo "Creating AppRun..."
cat >> ./AppRun << 'EOF'
#!/bin/sh
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
bebehei marked this conversation as resolved.
Show resolved Hide resolved
ARCH="$(uname -m)"
export PATH="$CURRENTDIR/usr/bin:$PATH"
[ -z "$APPIMAGE" ] && APPIMAGE="$0"
BIN="${ARGV0#./}"
unset ARGV0

case "${BIN}" in
dunst|dunstify)
exec "$CURRENTDIR/ld-musl-${ARCH}.so.1" "$CURRENTDIR/usr/bin/$BIN" "$@"
;;
dunstctl)
exec "$CURRENTDIR/usr/bin/$BIN" "$@"
;;
""|*)
BIN="$1"
case "${BIN}" in
dunst|dunstify)
shift
exec "$CURRENTDIR/ld-musl-${ARCH}.so.1" "$CURRENTDIR/usr/bin/$BIN" "$@"
;;
dunstctl)
shift
exec "$CURRENTDIR/usr/bin/$BIN" "$@"
;;
""|*)
echo "AppImage commands:"
echo " \"$APPIMAGE dunst\" runs dunst"
echo " \"$APPIMAGE dunstify\" runs dunstify"
echo " \"$APPIMAGE dunstctl\" runs dunstctl"
echo "You can also make and run symlinks to the AppImage with the names"
echo "dunstify and dunstctl to launch them automatically without extra args"
echo "running dunst..."
exec "$CURRENTDIR/ld-musl-${ARCH}.so.1" "$CURRENTDIR/usr/bin/dunst" "$@"
;;
esac
esac
Samueru-sama marked this conversation as resolved.
Show resolved Hide resolved
EOF
chmod +x ./AppRun

# Dummy Icon & Desktop
echo "Placing .desktop and icon..."
touch ./dunst.png && ln -s ./dunst.png ./.DirIcon # No official icon?
cat >> ./dunst.desktop << 'EOF' # No official .desktop?
[Desktop Entry]
Type=Application
Name=dunst
Icon=dunst
Exec=dunst
Categories=System
Hidden=true
EOF
bebehei marked this conversation as resolved.
Show resolved Hide resolved

# DEPLOY ALL LIBS
echo "Deploying dependencies..."
mkdir -p ./usr/lib
ldd ./usr/bin/* | awk -F"[> ]" '{print $4}' | xargs -I {} cp -vf {} ./usr/lib
if [ -f ./usr/lib/ld-musl-"$ARCH".so.1 ]; then
mv ./usr/lib/ld-musl-"$ARCH".so.1 ./
else
cp /lib/ld-musl-"$ARCH".so.1 ./
fi
find ./usr/bin -type f -exec patchelf --set-rpath '$ORIGIN/../lib' {} ';'
find ./usr/lib -type f -exec patchelf --set-rpath '$ORIGIN' {} ';'
find ./usr/lib ./usr/bin -type f -exec strip -s -R .comment --strip-unneeded {} ';'

# Do the thing!
echo "Generating AppImage..."
export VERSION="$(./AppRun dunst --version | awk 'FNR==1 {print $NF}')"
cd ..
wget -q "$APPIMAGETOOL" -O appimagetool
chmod +x ./appimagetool
./appimagetool --comp zstd \
--mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 \
-n ./AppDir ./dunst-"$VERSION"-"$ARCH".AppImage
ls
echo "All Done!"