Create AppImage from GitGub workflow

79 Views Asked by At

What I want to do

I have a python script named turnin.py and a requirements.txt file which you can find on GitHub

What I want is that I want to create multiple packages(like .deb, .rpm and .AppImage) through workflows.

The problem that I have

I created a GitHub workflow to create an AppImage file and upload it as an artifact.

name: Create AppImage

on:
  push:
    branches:
      - master

jobs:
  build-and-package:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.8

      - name: Install dependencies
        run: |
          python -m venv venv
          source venv/bin/activate
          pip install -r requirements.txt

      - name: Install FUSE
        run: |
          sudo apt-get install -y fuse

      - name: Prepare AppDir
        run: |
          mkdir -p AppDir
          cp -r venv AppDir/
          cp turnin.py AppDir/venv/bin
          chmod +x AppDir/venv/bin/turnin.py

          echo "[Desktop Entry]" >> AppDir/turnin.desktop
          echo "Name=TurnIn" >> AppDir/turnin.desktop
          echo "Exec=AppRun" >> AppDir/turnin.desktop
          echo "Icon=/venv/bin/turnin" >> AppDir/turnin.desktop
          echo "Type=Application" >> AppDir/turnin.desktop
          echo "Categories=Utility;" >> AppDir/turnin.desktop

          cp cse.logo.png AppDir/venv/bin/turnin.png

          # Add the shebang line to AppRun
          echo "#!/bin/bash" >> AppDir/AppRun
          echo 'APPDIR=$(dirname "$(readlink -f "$0")")' >> AppDir/AppRun
          echo 'PYTHON="$APPDIR/venv/bin/python"' >> AppDir/AppRun
          echo '$PYTHON "$APPDIR/venv/bin/turnin.py"' >> AppDir/AppRun
          chmod +x AppDir/AppRun

      - name: Download and install linuxdeploy
        run: |
          wget -c https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
          chmod +x linuxdeploy-x86_64.AppImage
          sudo mv linuxdeploy-x86_64.AppImage /usr/local/bin/linuxdeploy

      - name: Create AppImage
        run: |
          ARCH=x86_64 linuxdeploy --appdir AppDir --output appimage
          chmod +x ./*.AppImage

      - name: Upload AppImage artifact
        uses: actions/upload-artifact@v2
        with:
          name: turnin-appimage.AppImage
          path: ./*.AppImage

This code succesfully produces the appImage but I cannot run it because I get the result:

/tmp/.mount_TurnIn9yIsSZ/AppRun: line 4: /tmp/.mount_TurnIn9yIsSZ/venv/bin/python: No such file or directory

If I extract the app image file I find that the file venv/bin/python exists

lrwxrwxrwx 1 porfanid porfanid    49 Αυγ  21 21:02 python -> /opt/hostedtoolcache/Python/3.8.17/x64/bin/python
lrwxrwxrwx 1 porfanid porfanid     6 Αυγ  21 21:02 python3 -> python

So I cannot really find out what the problem is.

Where you can find the files

The AppImage file is uploaded here

0

There are 0 best solutions below