Repository navigation
103 lines (90 loc) · 3.5 KB
/
Copy pathwebsite.yml
File metadata and controls
103 lines (90 loc) · 3.5 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Builds the documentation site in website/ and deploys it to the Cloudflare
# Pages project "viva-mcp", which serves https://vivaui.dev. A push to main
# deploys; a pull request only builds, so a fork cannot deploy. website/README.md
# records the project settings and the two required repository secrets.
name: website
on:
push:
branches: [main]
paths:
- "website/**"
- "components/**"
- "internal/componentdemo/**"
- "internal/framebuild/**"
- "internal/platform/web/**"
- "internal/previewmeasure/**"
- "internal/render/**"
- "internal/scene/**"
- "internal/webbuild/**"
- "tools/docs/**"
- "cmd/component-preview/**"
- "cmd/viva/**"
- "ui/**"
- "app/**"
- "text/**"
- "headless/**"
- "go.mod"
- "go.sum"
- ".github/workflows/website.yml"
# Pull requests always build the site, even when they only touch Go code: a
# generated page can break without any change under website/.
pull_request:
workflow_dispatch:
permissions:
contents: read
# A pull request keeps only its newest build. A push to main is never cancelled:
# the job deploys, and two deploys racing would let the older one win. A queued
# deploy is what makes the site end up on the newest commit.
concurrency:
group: website-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: Build, test and deploy
runs-on: ubuntu-latest
# Repository secrets are empty when unset, which lets the deploy step notice
# a repository that has not been configured yet instead of failing red.
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
steps:
- uses: actions/checkout@v4
# The site build runs `go run ./tools/docs` before Astro, so the runner
# needs the toolchain from go.mod, not only Node.
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: website/package-lock.json
- name: Install site dependencies
working-directory: website
run: npm ci
- name: Build the static site
working-directory: website
run: npm run build
- name: Check the built routes, links and payloads
working-directory: website
run: npm run test:site
- name: Test the site sources
working-directory: website
run: npm test
- name: Type-check Astro and Svelte
working-directory: website
run: npm run check
# The project name comes from website/wrangler.toml; the directory is
# passed here because the build output lives outside website/.
#
# wrangler runs through npx at a pinned version instead of
# cloudflare/wrangler-action so the upload uses exactly the version that
# was tested, and no package is added to the site's lockfile.
- name: Deploy to Cloudflare Pages
if: github.event_name != 'pull_request' && env.CLOUDFLARE_API_TOKEN != ''
working-directory: website
run: npx --yes wrangler@4.153.0 pages deploy ../build/docs-site --branch=main
- name: Report a skipped deploy
if: github.event_name != 'pull_request' && env.CLOUDFLARE_API_TOKEN == ''
run: echo "::notice::CLOUDFLARE_API_TOKEN is not configured, so this build did not deploy."