From 42a8bfe9107ee40b3636e2a3307ad5af35e143e0 Mon Sep 17 00:00:00 2001
From: Cyril Danilevski <cydanil@gmail.com>
Date: Tue, 17 Jan 2023 00:26:18 +0100
Subject: [PATCH] Fix AppImage builds

---
 .github/workflows/appimage.yml | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml
index 1a48d950..0331c144 100644
--- a/.github/workflows/appimage.yml
+++ b/.github/workflows/appimage.yml
@@ -13,21 +13,28 @@ jobs:
 
     steps:
     - uses: actions/checkout@v2
+    - name: Install Ubuntu dependencies
+      run: >
+        sudo apt-get update -q && sudo apt-get install
+        --no-install-recommends -y xvfb python3-dev python3-gi
+        python3-gi-cairo gir1.2-gtk-3.0 libgirepository1.0-dev libcairo2-dev
+        intltool enchant python3-enchant gir1.2-poppler-0.18 python3-gst-1.0
+        python3-testresources imagemagick
+
     - name: Setup AppImage Environment
       run: |
-        sudo apt-get update -q
-        sudo apt-get -y install python3-testresources intltool imagemagick libgirepository1.0-dev
-        wget -c https://github.com/$(wget -q https://github.com/niess/python-appimage/releases/tag/python3.8 -O - | grep "python3.8.*-cp38-cp38-manylinux1_x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
+        wget -c https://github.com/$(wget -q https://github.com/niess/python-appimage/releases/expanded_assets/python3.8 -O - | grep "python3.8.*x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
         chmod +x ./python3*.AppImage
         ./python3*.AppImage --appimage-extract
-        wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
+        wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/655 -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
         chmod +x appimagetool-*.AppImage
 
     - name: Install Gourmand in AppImage
       run: |
+          C_INCLUDE_PATH=/usr/include/python3.8
+          export C_INCLUDE_PATH
           ./squashfs-root/AppRun -m pip install --upgrade pip
           ./squashfs-root/AppRun -m pip install decorator six BeautifulSoup4 html5lib lxml pyenchant pygobject Sphinx
-
           ./squashfs-root/AppRun setup.py bdist_wheel
           ./squashfs-root/AppRun -m pip install .[epub-export,mycookbook,pdf-export,spellcheck,web-import]
           ./squashfs-root/AppRun -m pip install dist/gourmand*.whl
@@ -45,6 +52,7 @@ jobs:
 
     - name: Pack AppImage
       run: |
+          chmod 0775 squashfs-root
           VERSION=${GITHUB_SHA::8} ./appimagetool-*.AppImage squashfs-root/
 
     - name: Upload AppImage