Build AppImage #1
This file contains hidden or 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: Build AppImage | |
| # Trigger: si attiva quando versiona.sh pubblica la release su GitHub | |
| # (release:published), oppure manualmente dalla UI Actions. | |
| # | |
| # Usiamo release:published invece di push:tags perché versiona.sh crea | |
| # la release DOPO il push del tag — la release è già pronta quando | |
| # questo job parte, quindi gh release upload non incontra race condition. | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag della release (es. v42)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write # necessario per caricare asset nella release | |
| jobs: | |
| appimage: | |
| name: Build AppImage (x86_64) | |
| runs-on: ubuntu-22.04 # glibc 2.35 — compatibile con distro 2022+ | |
| steps: | |
| # ── Determina il tag (release event oppure input manuale) ───────────── | |
| - name: Determina tag | |
| id: tag | |
| run: | | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| echo "value=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "value=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| # ── Checkout al tag specificato ─────────────────────────────────────── | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ steps.tag.outputs.value }} | |
| # ── Calcola variabili di versione ───────────────────────────────────── | |
| - name: Versione | |
| id: ver | |
| run: | | |
| TAG="${{ steps.tag.outputs.value }}" | |
| VER="${TAG#v}" | |
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | |
| echo "version=${VER}" >> "$GITHUB_OUTPUT" | |
| # ── Dipendenze di sistema ───────────────────────────────────────────── | |
| # PyGObject + typelib GTK3/VTE/gtk-vnc di sistema (non installabili via pip): | |
| # pcm.spec li raccoglie da qui e li bundla nell'AppImage. | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y --no-install-recommends \ | |
| python3-gi python3-gi-cairo python3-venv \ | |
| gir1.2-gtk-3.0 gir1.2-vte-2.91 gir1.2-gtk-vnc-2.0 gir1.2-gdkpixbuf-2.0 \ | |
| libgtk-3-0 libvte-2.91-0 libgtk-vnc-2.0-0 \ | |
| patchelf desktop-file-utils file \ | |
| xvfb # display virtuale, per sicurezza in analisi PyInstaller | |
| # ── Virtualenv isolato (eredita gi dal sistema) ──────────────────────── | |
| - name: Prepara virtualenv | |
| run: | | |
| python3 -m venv --system-site-packages .venv-build | |
| source .venv-build/bin/activate | |
| pip install --quiet --upgrade pip | |
| pip install --quiet cryptography paramiko pyftpdlib | |
| pip install --quiet "pyinstaller>=6.3" pyinstaller-hooks-contrib | |
| # ── Build PyInstaller ───────────────────────────────────────────────── | |
| - name: Build with PyInstaller | |
| run: | | |
| source .venv-build/bin/activate | |
| xvfb-run --auto-servernum \ | |
| python3 -m PyInstaller packaging/appimage/pcm.spec --noconfirm | |
| # ── Assembla AppDir ─────────────────────────────────────────────────── | |
| - name: Create AppDir | |
| run: bash packaging/appimage/make-appdir.sh | |
| # ── appimagetool ────────────────────────────────────────────────────── | |
| - name: Download appimagetool | |
| run: | | |
| wget -q \ | |
| "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" \ | |
| -O appimagetool | |
| chmod +x appimagetool | |
| # Estrai senza FUSE (non disponibile in GitHub Actions) | |
| ./appimagetool --appimage-extract | |
| mv squashfs-root appimagetool-extracted | |
| - name: Build AppImage | |
| id: build_appimage | |
| run: | | |
| VERSION="${{ steps.ver.outputs.version }}" | |
| APPIMAGE_NAME="PCM-${VERSION}-x86_64.AppImage" | |
| ARCH=x86_64 appimagetool-extracted/AppRun \ | |
| --comp zstd \ | |
| dist/pcm.AppDir \ | |
| "${APPIMAGE_NAME}" | |
| echo "name=${APPIMAGE_NAME}" >> "$GITHUB_OUTPUT" | |
| # ── Verifica ───────────────────────────────────────────────────────── | |
| - name: Verify AppImage | |
| run: | | |
| ls -lh "${{ steps.build_appimage.outputs.name }}" | |
| file "${{ steps.build_appimage.outputs.name }}" | |
| # ── Upload alla release GitHub ──────────────────────────────────────── | |
| - name: Upload AppImage to release | |
| run: | | |
| gh release upload "${{ steps.ver.outputs.tag }}" \ | |
| "${{ steps.build_appimage.outputs.name }}" --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |