Repository navigation
63 lines (50 loc) · 1.63 KB
/
Copy pathdeploy.yml
File metadata and controls
63 lines (50 loc) · 1.63 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
name: Build & Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
# Needed to push the built site to the gh-pages branch.
permissions:
contents: write
# Never run two deployments at once; a newer commit supersedes an in-flight one.
concurrency:
group: gh-pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Build content index
run: npm run content
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Typecheck
run: npx tsc -b --noEmit
- name: Build site
run: npx vite build
# Pages is configured as "Deploy from a branch" -> gh-pages -> / (root).
# The branch holds only build output; its history is replaced each deploy.
- name: Publish to gh-pages
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
run: |
set -euo pipefail
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
cd dist
touch .nojekyll # stop Pages running Jekyll over assets
git init -q
git add -A
git commit -q -m "deploy: ${GITHUB_SHA::7}"
git push -f "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}