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 1 commit
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
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,28 @@ jobs:
runs-on: ubuntu-latest
container:
image: ghcr.io/dunst-project/docker-images:misc-doxygen

appimage:
runs-on: ubuntu-22.04
Samueru-sama marked this conversation as resolved.
Show resolved Hide resolved
container: alpine:latest
steps:
- uses: actions/checkout@v4

- name: build appimage
if: always()
run: |
apk add wget git 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
Samueru-sama marked this conversation as resolved.
Show resolved Hide resolved

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'
91 changes: 91 additions & 0 deletions AppImage/make-appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/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-x86_64.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
export PATH="$CURRENTDIR/usr/bin:$PATH"
[ -z "$APPIMAGE" ] && APPIMAGE="$0"
BIN="${ARGV0#./}"
unset ARGV0
if [ -f "$CURRENTDIR/usr/bin/$BIN" ]; then
if [ "$BIN" = "dunstctl" ]; then
exec "$CURRENTDIR/usr/bin/$BIN" "$@"
else
exec "$CURRENTDIR/ld-musl-x86_64.so.1" "$CURRENTDIR/usr/bin/$BIN" "$@"
fi
elif [ "$1" = "--notify" ]; then
shift
exec "$CURRENTDIR/ld-musl-x86_64.so.1" "$CURRENTDIR"/usr/bin/dunstify "$@"
elif [ "$1" = "--ctl" ]; then
shift
exec "$CURRENTDIR"/usr/bin/dunstctl "$@"
else
if [ -z "$1" ]; then
echo "AppImage commands:"
echo " \"$APPIMAGE\" runs dunst"
echo " \"$APPIMAGE --notify\" runs dunstify"
echo " \"$APPIMAGE --ctl\" 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..."
fi
exec "$CURRENTDIR/ld-musl-x86_64.so.1" "$CURRENTDIR/usr/bin/dunst" "$@"
fi
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-x86_64.so.1 ]; then
mv ./usr/lib/ld-musl-x86_64.so.1 ./
Samueru-sama marked this conversation as resolved.
Show resolved Hide resolved
else
cp /lib/ld-musl-x86_64.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 --version | awk '{print $(NF-1)}')" # This breaks for some reason?
Samueru-sama marked this conversation as resolved.
Show resolved Hide resolved
cd ..
wget -q "$APPIMAGETOOL" -O appimagetool
chmod +x ./appimagetool
./appimagetool --comp zstd \
--mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 \
-n ./AppDir ./dunst-"$ARCH".AppImage
ls
echo "All Done!"