-
Notifications
You must be signed in to change notification settings - Fork 3
79 lines (74 loc) · 3.17 KB
/
Copy pathdeploy.yml
File metadata and controls
79 lines (74 loc) · 3.17 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: deploy
on:
push:
branches:
- main
workflow_run:
workflows:
- import_eventdrake
- import_fancons
- import_concat
- import_rams
types:
- completed
workflow_dispatch:
# One deployment at a time: Pages rejects a deployment while another is in
# progress, so back-to-back merges raced and failed. Runs queued between the
# in-progress one and the newest are skipped (each run deploys full HEAD
# anyway); in-progress deployments are never cancelled. Same pattern as
# github.com/actions/starter-workflows/blob/main/pages/static.yml.
concurrency:
group: pages
cancel-in-progress: false
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v7
- run: |
mkdir "$RUNNER_TEMP/out" &&
./tools/materialize.py "$RUNNER_TEMP/out" &&
./tools/render_markdown.py < README.md > "$RUNNER_TEMP/out/index.html" &&
./tools/render_index.py "$RUNNER_TEMP/out/series" data.cons.fyi/series > "$RUNNER_TEMP/out/series/index.html" &&
./tools/render_index.py "$RUNNER_TEMP/out/events" data.cons.fyi/events > "$RUNNER_TEMP/out/events/index.html"
- uses: actions/upload-pages-artifact@v3
with:
path: "${{ runner.temp }}/out"
- uses: actions/deploy-pages@v4
- id: trigger
run: curl --fail-with-body -u $BSKY_LABELER_TRIGGER_KEY -XPOST https://bsky-labeler.cons.fyi/trigger
env:
BSKY_LABELER_TRIGGER_KEY: ${{ secrets.BSKY_LABELER_TRIGGER_KEY }}
# A failed /trigger means the labeler didn't pick up this deploy's data,
# while the Pages publish above still succeeded, so nothing else surfaces
# it. Page the ops channel, same pattern as bsky-labeler's monitor.yml:
# missing secrets or a Telegram outage degrade to log-only and never
# change the run's red/green.
- name: Alert ops channel (trigger failed)
if: ${{ failure() && steps.trigger.outcome == 'failure' }}
env:
OPS_TOKEN: ${{ secrets.OPS_TELEGRAM_BOT_TOKEN }}
OPS_CHAT: ${{ secrets.OPS_TELEGRAM_CHAT_ID }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
if [ -z "$OPS_TOKEN" ] || [ -z "$OPS_CHAT" ]; then
echo "::warning::labeler /trigger FAILED but ops Telegram secrets are not set; no alert sent"
exit 0
fi
code=$(curl -sS -o /tmp/tg_resp -w "%{http_code}" --max-time 20 \
"https://api.telegram.org/bot${OPS_TOKEN}/sendMessage" \
--data-urlencode "chat_id=${OPS_CHAT}" \
--data-urlencode "text=data deploy: labeler /trigger FAILED at $(date -u +%Y-%m-%dT%H:%MZ). The site published, but labels and key-date announcements did not sync.
${RUN_URL}" \
--data-urlencode "disable_web_page_preview=true") || code=000
if [ "$code" != "200" ]; then
echo "::warning::trigger failure alert could not be delivered (Telegram HTTP $code)"
else
echo "trigger failure alert delivered"
fi
exit 0