chore: release 225 #114
Workflow file for this run
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 PCM Linux GTK3 | |
| on: | |
| push: | |
| branches: ["**"] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: ["**"] | |
| jobs: | |
| build: | |
| name: Build tar.gz + zip + deb | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Determine version and release info | |
| id: version | |
| run: | | |
| if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| RELEASE_TAG="v${VERSION}" | |
| IS_TAG=true | |
| else | |
| SHORT_SHA=$(git rev-parse --short HEAD) | |
| VERSION="0.0.0-${SHORT_SHA}" | |
| RELEASE_TAG="dev-${SHORT_SHA}" | |
| IS_TAG=false | |
| COMMIT_SUBJECT=$(git log -1 --pretty=%s) | |
| RELEASE_NAME="PCM dev ${SHORT_SHA} - ${COMMIT_SUBJECT}" | |
| fi | |
| echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "RELEASE_TAG=${RELEASE_TAG}" >> "$GITHUB_OUTPUT" | |
| echo "IS_TAG=${IS_TAG}" >> "$GITHUB_OUTPUT" | |
| echo "RELEASE_NAME=${RELEASE_NAME:-}" >> "$GITHUB_OUTPUT" | |
| echo "Versione: ${VERSION}" | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y --no-install-recommends dpkg gir1.2-gtk-3.0 gir1.2-vte-2.91 xvfb | |
| - name: Run tests | |
| run: | | |
| pip install pytest cryptography paramiko pyftpdlib pyopenssl pynacl | |
| cd gtk3 && xvfb-run --auto-servernum python3 -m pytest tests/ -v --tb=short | |
| - name: Build packages | |
| run: | | |
| bash linuxbuild/build.sh "${{ steps.version.outputs.VERSION }}" --zip --deb | |
| - name: Upload artifacts (Actions interno — solo per PR e ispezione) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PCM_v${{ steps.version.outputs.VERSION }}_Linux | |
| path: | | |
| dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.tar.gz | |
| dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.zip | |
| dist/pcm_${{ steps.version.outputs.VERSION }}_all.deb | |
| if-no-files-found: error | |
| # ── Release per push su branch (dev build) ────────────────────────────── | |
| # Per i tag NON creiamo la release: la crea versiona.sh con le note AI. | |
| - name: Create dev release (branch push only) | |
| if: github.event_name == 'push' && steps.version.outputs.IS_TAG == 'false' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| git log -1 --pretty=%B > /tmp/release_notes.txt | |
| gh release create "${{ steps.version.outputs.RELEASE_TAG }}" \ | |
| --title "${{ steps.version.outputs.RELEASE_NAME }}" \ | |
| --prerelease \ | |
| --notes-file /tmp/release_notes.txt \ | |
| "dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.tar.gz" \ | |
| "dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.zip" \ | |
| "dist/pcm_${{ steps.version.outputs.VERSION }}_all.deb" | |
| # ── Upload artefatti su release esistente (tag push) ──────────────────── | |
| # versiona.sh crea la release con gh release create (che pusha il tag). | |
| # Quando Actions riceve il push del tag la release esiste già. | |
| # Il loop di attesa copre il caso estremo in cui versiona.sh sia lento. | |
| - name: Upload artifacts to existing release (tag push only) | |
| if: github.event_name == 'push' && steps.version.outputs.IS_TAG == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| RELEASE_TAG="${{ steps.version.outputs.RELEASE_TAG }}" | |
| echo "Attesa release ${RELEASE_TAG}..." | |
| for i in $(seq 1 24); do | |
| gh release view "${RELEASE_TAG}" &>/dev/null && break | |
| echo "Tentativo ${i}/24, attendo 10s..." | |
| sleep 10 | |
| done | |
| gh release upload "${RELEASE_TAG}" \ | |
| "dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.tar.gz" \ | |
| "dist/PCM_v${{ steps.version.outputs.VERSION }}_Linux_GTK3.zip" \ | |
| "dist/pcm_${{ steps.version.outputs.VERSION }}_all.deb" \ | |
| --clobber |