-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (61 loc) · 2.84 KB
/
Copy pathdeploy.yml
File metadata and controls
65 lines (61 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy to GitHub Pages
on:
push:
branches: [main, baltic]
workflow_dispatch: # redeploy manuale (es. dopo un cambio di config Pages)
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url || steps.deploy_try2.outputs.page_url || steps.deploy_try1.outputs.page_url }}
steps:
- uses: actions/checkout@v6
# IMPORTANTE: GitHub Pages DEVE restare in modalità "GitHub Actions"
# (build_type=workflow). Se Pages torna in modalità "legacy/branch" serve i
# SOLI file committati su main → l'intero albero #15 (git-ignored) va 404.
# configure-pages riafferma la modalità Actions a ogni deploy (idempotente).
- uses: actions/configure-pages@v5
with:
enablement: true
# Le pagine SEO per-ente/area/categoria + i sitemap (#15) sono GIT-IGNORED
# (artifact-only): vanno rigenerate qui dai dati COMMITTATI (data.json /
# data-detail.json / kpi.json dell'ultima nightly) prima dell'upload, così
# un deploy-on-push include l'intero albero /ente /aree /categoria /dominio
# + sitemap.xml e non lascia 404. Stesso generatore della nightly.
- uses: astral-sh/setup-uv@v7
- run: uv python install 3.13
- run: uv sync
# --no-domain-aliases: vedi nota in nightly.yml. Dimezza i file (~53k→~31k)
# per un sync di Pages affidabile; gli alias /dominio/ sono canonical→ente e
# non erano nel sitemap.
- name: Build per-entity & area SEO pages + sitemap index (#15)
run: uv run python3 scripts/build_entity_pages.py --country IT --no-domain-aliases
- uses: actions/upload-pages-artifact@v4
with:
path: .
# RETRY del deploy-pages: Pages ri-sincronizza TUTTI i ~31k file a ogni deploy
# (full-snapshot, nessun incrementale) e a volte fallisce con "Deployment
# failed, try again later" — transiente infra RETRIABLE. 3 tentativi con
# backoff (30s, 90s) → self-healing anche nelle finestre in cui Pages è degradato.
- id: deploy_try1
uses: actions/deploy-pages@v4
continue-on-error: true
- if: steps.deploy_try1.outcome == 'failure'
run: 'echo "deploy 1/3 fallito (transiente): retry tra 30s..."; sleep 30'
- id: deploy_try2
if: steps.deploy_try1.outcome == 'failure'
uses: actions/deploy-pages@v4
continue-on-error: true
- if: steps.deploy_try1.outcome == 'failure' && steps.deploy_try2.outcome == 'failure'
run: 'echo "deploy 2/3 fallito (transiente): retry tra 90s..."; sleep 90'
- id: deployment
if: steps.deploy_try1.outcome == 'failure' && steps.deploy_try2.outcome == 'failure'
uses: actions/deploy-pages@v4