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
This commit is contained in:
11 files changed
+1116
-8
No files matched your search
@@ -0,0 +1,92 @@
|
||||
# =============================================================================
|
||||
# CI — verifica completa a ogni push su main e a ogni pull request.
|
||||
#
|
||||
# RUNNER: `runs-on: docker` è il label più comune di forgejo-runner. Se il runner
|
||||
# dell'istanza usa un altro label (es. `ubuntu-latest`, `self-hosted`), sostituirlo
|
||||
# in tutti i job: Impostazioni del repository → Actions → Runner mostra i label disponibili.
|
||||
#
|
||||
# CONTAINER: l'immagine Playwright DEVE avere la stessa versione di @playwright/test
|
||||
# in package.json (oggi 1.56.1). Aggiornando Playwright, aggiornare anche qui e in release.yml.
|
||||
#
|
||||
# AZIONI: referenziate con URL completo su code.forgejo.org, così il workflow non dipende
|
||||
# dall'impostazione DEFAULT_ACTIONS_URL dell'istanza.
|
||||
#
|
||||
# SEGRETI: questo workflow non ne usa. Il segreto facoltativo FORGEJO_TOKEN serve solo a
|
||||
# release.yml (vedi il commento in quel file e il README).
|
||||
# =============================================================================
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
ASTRO_TELEMETRY_DISABLED: '1'
|
||||
CI: 'true'
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
name: Verifica (lint, build, test, Lighthouse)
|
||||
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: 30
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
|
||||
- uses: https://code.forgejo.org/actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: npm
|
||||
|
||||
- name: Dipendenze
|
||||
run: npm ci
|
||||
|
||||
- name: npm run verify
|
||||
run: npm run verify
|
||||
|
||||
- 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
|
||||
|
||||
- name: Report Lighthouse
|
||||
if: always()
|
||||
uses: https://code.forgejo.org/actions/upload-artifact@v3
|
||||
with:
|
||||
name: lighthouse
|
||||
path: .lighthouseci
|
||||
retention-days: 14
|
||||
|
||||
- name: Artifact dist
|
||||
uses: https://code.forgejo.org/actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: dist
|
||||
retention-days: 7
|
||||
|
||||
external-links:
|
||||
name: Link esterni (non bloccante)
|
||||
runs-on: docker # label del runner: adattare (es. ubuntu-latest)
|
||||
container:
|
||||
image: node:24
|
||||
continue-on-error: true # dipende dalla rete del runner e dai siti esterni
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
|
||||
- name: Dipendenze
|
||||
run: npm ci
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Controllo dei link esterni
|
||||
run: npm run test:links -- --external
|
||||
@@ -0,0 +1,104 @@
|
||||
# =============================================================================
|
||||
# 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
|
||||
Reference in new issue
Block a user