Repository navigation
82 lines (73 loc) · 2.48 KB
/
Copy pathdeploy_website.yml
File metadata and controls
82 lines (73 loc) · 2.48 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
name: GitHub Pages
on:
workflow_dispatch:
release:
# Rebuild so the download page picks up the newly published (pre-)release.
types: [published]
push:
branches:
- main
paths:
- '.github/workflows/deploy_website.yml'
- 'Website/**'
pull_request:
paths:
- '.github/workflows/deploy_website.yml'
- 'Website/**'
# Runs that deploy (main, release, manual) run one after the other incl. the build, so the last triggered run also
# deploys last (e.g. a release build isn't overwritten by an older main build). Outdated PR runs are cancelled.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || 'deploy' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-website:
name: "Build Website"
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: Website
steps:
- uses: actions/checkout@v7
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 22
cache: yarn
cache-dependency-path: Website/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build
env:
# Used by scripts/fetch-release-data.mjs to raise the GitHub API rate limit.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload website
uses: actions/upload-artifact@v7
if: github.event_name == 'release' || (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')
with:
name: website
path: Website/build
# Keep .well-known/ and .nojekyll (hidden files are skipped by default).
include-hidden-files: true
retention-days: 1
# Separate job, so only the deployment gets write access (not the build with its npm dependencies).
deploy-website:
name: "Deploy Website"
needs: build-website
if: github.event_name == 'release' || (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download website
uses: actions/download-artifact@v8
with:
name: website
path: build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build