Update linux-build.yml #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux Build Test | |
on: | |
push: | |
branches: | |
- appimage-test | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install PyQt5 pyinstaller | |
- name: Build application | |
run: | | |
pyinstaller --onefile --windowed main.py | |
- name: List Dist Directory | |
run: | | |
ls -l dist/ # Check if main executable is here | |
- name: Install FUSE and AppImage tools | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libfuse2 wget appstream # Install appstreamcli if desired. | |
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage | |
chmod +x appimagetool-x86_64.AppImage | |
- name: Create AppDir | |
run: | | |
mkdir -p MyApp.AppDir/usr/bin | |
cp dist/main MyApp.AppDir/usr/bin/ | |
# Create AppRun script | |
cat > MyApp.AppDir/AppRun << EOL | |
#!/bin/bash | |
HERE="\$(dirname "\$(readlink -f "\${0}")")" | |
export PATH="\${HERE}/usr/bin:\${PATH}" | |
exec "\${HERE}/usr/bin/main" "\$@" | |
EOL | |
chmod +x MyApp.AppDir/AppRun | |
# Create .desktop file without an icon reference. | |
echo "[Desktop Entry] | |
Name=MyApp | |
Exec=main | |
Type=Application | |
Categories=Utility;" > MyApp.AppDir/myapp.desktop | |
# No need to copy an icon since we're skipping it. | |
- name: Verify AppDir Contents | |
run: | | |
ls -l MyApp.AppDir/ # List contents of AppDir to verify files exist. | |
- name: Build AppImage | |
run: | | |
./appimagetool-x86_64.AppImage MyApp.AppDir MyApp-x86_64.AppImage | |
- name: Upload AppImage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: MyApp-x86_64.AppImage | |
path: MyApp-x86_64.AppImage |