Files
Studio_Grasso/.forgejo/workflows/release.yml
T
Claude e10745b061 ci: workflow Forgejo, pacchetto di rilascio e file di deploy
- .forgejo/workflows/ci.yml: npm run verify nel container Playwright a ogni
  push su main e pull request, report come artifact, link esterni non bloccanti
- .forgejo/workflows/release.yml: ai tag vX.Y.Z verifica, pacchetto e
  pubblicazione nella sezione Release con forgejo-release (token FORGEJO_TOKEN)
- scripts/package.mjs: zip e tar.gz riproducibili, SHA256SUMS.txt, BUILD-INFO.txt
- scripts/check-package.mjs: confronto 1:1 con dist/, impronte, sha256sum -c
- scripts/changelog-notes.mjs e release-upload.sh (API REST di Forgejo)
- deploy/: nginx.conf.example, gestore PHP del modulo, esempio di deploy
  automatico (rsync, FTPS, rclone) non attivo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016zJ9ZWGKvoKoxYwbmnRKdJ
2026-10-15 23:05:12 +00:00

105 lines
4.1 KiB
YAML

# =============================================================================
# Release — a ogni tag vX.Y.Z: verifica completa, pacchetto (zip, tar.gz, SHA256SUMS.txt,
# BUILD-INFO.txt) e pubblicazione nella sezione «Release» del repository Forgejo.
#
# Come rilasciare (dettagli nel README):
# 1. aggiornare "version" in package.json e la sezione ## [X.Y.Z] di CHANGELOG.md;
# 2. commit su main; 3. git tag vX.Y.Z && git push origin vX.Y.Z
# Il workflow si ferma se il tag non coincide con la versione di package.json o se manca
# la sezione del CHANGELOG.
#
# RUNNER: `runs-on: docker` è il label più comune di forgejo-runner; sostituirlo se il
# runner dell'istanza ne usa un altro (es. `ubuntu-latest`).
#
# TOKEN: su alcune istanze il token automatico del workflow non può creare release.
# In tal caso creare un access token (Impostazioni utente → Applicazioni → Genera token,
# permesso «write:repository») e salvarlo come segreto del repository con nome
# FORGEJO_TOKEN (Impostazioni del repository → Actions → Segreti). Se il segreto esiste
# viene usato al posto del token automatico.
# =============================================================================
name: Release
on:
push:
tags: ['v*.*.*']
env:
ASTRO_TELEMETRY_DISABLED: '1'
CI: 'true'
jobs:
release:
name: Pacchetto e pubblicazione
runs-on: docker # label del runner: adattare (es. ubuntu-latest)
container:
image: mcr.microsoft.com/playwright:v1.56.1-noble # = versione di @playwright/test
timeout-minutes: 40
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
with:
fetch-depth: 0
- uses: https://code.forgejo.org/actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: Data riproducibile (data del commit)
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)" >> "$GITHUB_ENV"
- name: Dipendenze
run: npm ci
- name: Controlli preliminari (tag, versione, CHANGELOG)
env:
RELEASE_VERSION: ${{ github.ref_name }}
run: |
node -e 'const v=require("./package.json").version; const t=process.env.RELEASE_VERSION.replace(/^v/,""); if (v!==t) { console.error(`Il tag ${process.env.RELEASE_VERSION} non corrisponde a package.json (${v})`); process.exit(1); }'
node scripts/changelog-notes.mjs "$RELEASE_VERSION" > /dev/null
- name: npm run verify # nessuna release senza test verdi
run: npm run verify
- name: npm run package # crea release/ e ne verifica il contenuto
run: npm run package
env:
RELEASE_VERSION: ${{ github.ref_name }}
- name: Note di rilascio dal CHANGELOG
id: notes
run: |
{
echo 'notes<<NOTES_EOF'
node scripts/changelog-notes.mjs "${{ github.ref_name }}"
echo 'NOTES_EOF'
} >> "$GITHUB_OUTPUT"
- name: Pubblica la release su Forgejo
uses: https://code.forgejo.org/actions/forgejo-release@v2
with:
direction: upload
url: ${{ github.server_url }}
repo: ${{ github.repository }}
tag: ${{ github.ref_name }}
token: ${{ secrets.FORGEJO_TOKEN || secrets.GITHUB_TOKEN }}
release-dir: release # contiene SOLO zip, tar.gz, SHA256SUMS.txt, BUILD-INFO.txt
release-notes: ${{ steps.notes.outputs.notes }}
prerelease: ${{ contains(github.ref_name, '-') }}
verbose: true
# Alternativa all'action (es. istanze in cui l'action non è disponibile):
# - name: Pubblica la release (API REST)
# env:
# FORGEJO_URL: ${{ github.server_url }}
# FORGEJO_REPO: ${{ github.repository }}
# FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN || secrets.GITHUB_TOKEN }}
# run: scripts/release-upload.sh "${{ github.ref_name }}" release
- name: Report Playwright (solo in caso di errore)
if: failure()
uses: https://code.forgejo.org/actions/upload-artifact@v3 # usare @v4 se l'istanza Forgejo lo supporta
with:
name: playwright-report
path: playwright-report
retention-days: 14