Skip to content

Update README.md

Update README.md #2

Workflow file for this run

name: Release Python Application
on:
push:
tags:
- 'v*' # Run workflow on version tags, e.g. v1.0.0
workflow_dispatch:
inputs:
tag_name:
description: 'Version tag for this release (e.g. v1.0.0)'
required: true
default: 'v1.0.0'
jobs:
build-and-release:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
asset_name: go-dispatch-proxy-gui-windows
asset_extension: .zip
- os: ubuntu-latest
asset_name: go-dispatch-proxy-gui-linux
asset_extension: .tar.gz
- os: macos-latest
asset_name: go-dispatch-proxy-gui-macos
asset_extension: .zip
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Necessario per accedere ai tag
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Installa una versione specifica di PyInstaller che sappiamo funzionare
pip install pyinstaller==5.13.0
# Installa le dipendenze dal requirements.txt se esiste
if [ -f requirements.txt ]; then
echo "Installazione dipendenze da requirements.txt"
pip install -r requirements.txt
else
echo "File requirements.txt non trovato"
# Crea un file vuoto per evitare errori
touch requirements.txt
fi
# Verifica che il file .spec esista
if [ -f "go-dispatch-proxy-gui.spec" ]; then
echo "File .spec trovato"
cat go-dispatch-proxy-gui.spec
else
echo "ERRORE: File .spec non trovato!"
# Crea un file .spec minimo se non esiste
echo 'from PyInstaller.building.build_main import Analysis, PYZ, EXE, COLLECT
a = Analysis(["go_dispatch_proxy_gui.py"])

Check failure on line 67 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

You have an error in your yaml syntax on line 67
pyz = PYZ(a.pure, a.zipped_data)
exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, name="go-dispatch-proxy-gui")
coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, name="go-dispatch-proxy-gui")' > go-dispatch-proxy-gui.spec
fi
# Lista tutti i file nella directory corrente
echo "File nella directory di lavoro:"
ls -la
shell: bash
- name: Determine tag name
id: get_tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "::set-output name=tag::${{ github.event.inputs.tag_name }}"
else
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
fi
shell: bash
- name: Build with PyInstaller
run: |
# Stampa informazioni su Python e PyInstaller per debug
python --version
pip list | grep pyinstaller
# Esegui PyInstaller con output dettagliato
pyinstaller --log-level=DEBUG go-dispatch-proxy-gui.spec
# Debug: Stampa il contenuto della directory corrente e della directory dist se esiste
echo "Directory contenuto:"
ls -la
if [ -d "dist" ]; then
echo "Contenuto della directory dist:"
ls -la dist
else
echo "La directory dist non esiste!"
fi
shell: bash
# Usiamo una logica più sicura per gli archivi
- name: Archive Windows build
if: matrix.os == 'windows-latest'
run: |
# Crea una directory per gli archivi
mkdir -p artifacts
# Verifica se dist esiste e contiene file
if (Test-Path -Path "dist") {
Write-Host "Contenuto della directory dist:"
Get-ChildItem -Path "dist" -Recurse | Format-Table -Property FullName
if (Get-ChildItem -Path "dist" | Where-Object { !$_.PSIsContainer }) {
Write-Host "Comprimendo gli eseguibili in archivio..."
Compress-Archive -Path "dist/*" -DestinationPath "artifacts/${{ matrix.asset_name }}${{ matrix.asset_extension }}"
} else {
echo "dist directory is empty or contains only subdirectories"
dir dist
# Crea un file vuoto per non far fallire l'upload
New-Item -Path "artifacts/build-log.txt" -ItemType "file" -Value "Build resulted in empty dist directory"
}
} else {
echo "dist directory does not exist"
dir
# Crea un file vuoto per non far fallire l'upload
New-Item -Path "artifacts/build-log.txt" -ItemType "file" -Value "Build failed to create dist directory"
}
shell: pwsh
- name: Archive Linux build
if: matrix.os == 'ubuntu-latest'
run: |
# Crea una directory per gli archivi
mkdir -p artifacts
# Verifica se dist esiste e contiene file
if [ -d "dist" ]; then
echo "Contenuto della directory dist:"
find dist -type f -o -type d | sort
if [ "$(ls -A dist)" ]; then
echo "Comprimendo gli eseguibili in archivio..."
tar -czvf artifacts/${{ matrix.asset_name }}${{ matrix.asset_extension }} -C dist .
else
echo "dist directory does not exist or is empty"
ls -la
# Crea un file vuoto per non far fallire l'upload
echo "Build failed to create proper dist directory" > artifacts/build-log.txt
fi
shell: bash
- name: Archive macOS build
if: matrix.os == 'macos-latest'
run: |
# Crea una directory per gli archivi
mkdir -p artifacts
# Verifica se dist esiste e contiene file
if [ -d "dist" ]; then
echo "Contenuto della directory dist:"
find dist -type f -o -type d | sort
if [ "$(ls -A dist)" ]; then
echo "Comprimendo gli eseguibili in archivio..."
ditto -c -k --keepParent dist artifacts/${{ matrix.asset_name }}${{ matrix.asset_extension }}
else
echo "dist directory does not exist or is empty"
ls -la
# Crea un file vuoto per non far fallire l'upload
echo "Build failed to create proper dist directory" > artifacts/build-log.txt
fi
shell: bash
# Carica gli archivi come artefatti (opzionale, utile per debug)
- name: Upload build artifacts
uses: actions/upload-pages-artifact@v3
with:
name: release-${{ matrix.os }}
path: artifacts/
# Crea o aggiorna la release e carica gli asset
- name: Create/Update Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_tag.outputs.tag }}
name: Release ${{ steps.get_tag.outputs.tag }}
draft: false
prerelease: false
files: |
artifacts/${{ matrix.asset_name }}${{ matrix.asset_extension }}
artifacts/build-log.txt