Repository navigation
81 lines (72 loc) · 3.1 KB
/
Copy pathdeploy.yml
File metadata and controls
81 lines (72 loc) · 3.1 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
80
81
name: Deploy website
# Deploys are isolated from the build-verification workflow so that
# credentials are never reachable from PR-triggered runs. Trusted
# triggers only:
# * push to main — ship every merged change
# * nightly schedule — refresh upstream NuGet API docs without a commit
# * workflow_dispatch — manual escape hatch
on:
push:
branches: [ main ]
schedule:
# 03:00 UTC daily — off-peak for shared runners and quiet across the
# main contributor timezones.
- cron: '0 3 * * *'
workflow_dispatch:
# Read-only on the repo; the deploy talks to Cloudflare via its own
# API token (CLOUDFLARE_API_TOKEN), not GITHUB_TOKEN.
permissions:
contents: read
# Serialise deploys so a cron run and a push-triggered run can never
# overlap on the same Pages project. cancel-in-progress: false lets
# whichever is already running finish — losing the cron deploy to a
# push that arrives mid-run would be fine; the inverse less so.
concurrency:
group: deploy-website-production
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
# Bind the Cloudflare credentials to a GitHub Environment so they
# only resolve for jobs that opt in by name. Required-reviewer or
# branch protection can be layered on later via repo settings
# without touching the workflow.
environment: production
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
with:
dotnet-version: 10.0.x
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: '24'
- name: Cache fetched packages
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: |
~/.nuget/packages
.api-cache
build/_intermediate
# Same cache surface as the build workflow; sharing the key
# means a PR build warm-up benefits the production deploy.
key: ${{ runner.os }}-website-${{ hashFiles('nuget-packages.json', 'build/_build.csproj', 'Directory.Packages.props') }}
- name: Build website
run: ./build.sh build
- name: Deploy to Cloudflare Pages
# Secrets travel via env vars rather than command-line expansion
# so they never surface in process listings or CI logs. site/
# is the output WithOutput() in build/Program.cs writes to.
# --branch=main marks the upload as a production deploy; any
# other value would land as a preview.
# WRANGLER_SEND_METRICS=false opts out of Wrangler's telemetry
# for this invocation (no global config state on the runner).
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
WRANGLER_SEND_METRICS: 'false'
run: npx wrangler@latest pages deploy site --project-name=rxui --branch=main