Skip to content

Update release.yml

Update release.yml #13

Workflow file for this run

name: Build Python Application
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9']
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
shell: bash
- name: Build with PyInstaller
run: |
pyinstaller go-dispatch-proxy-gui.spec
# Debug: Stampa il contenuto della directory corrente e della directory dist se esiste
ls -la
if [ -d "dist" ]; then ls -la dist; 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") {
if (Get-ChildItem -Path "dist" | Where-Object { !$_.PSIsContainer }) {
Compress-Archive -Path "dist/*" -DestinationPath "artifacts/go-dispatch-proxy-gui-windows.zip"
} 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" ] && [ "$(ls -A dist)" ]; then
tar -czvf artifacts/go-dispatch-proxy-gui-linux.tar.gz -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" ] && [ "$(ls -A dist)" ]; then
ditto -c -k --keepParent dist artifacts/go-dispatch-proxy-gui-macos.zip
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
# Salviamo gli archivi o i log come artefatti
- name: Upload build archives
uses: actions/upload-pages-artifact@v3
with:
name: build-${{ matrix.os }}
path: artifacts/