-
Notifications
You must be signed in to change notification settings - Fork 133
85 lines (72 loc) · 2.43 KB
/
build-docs.yml
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
name: Build docs site
on:
push:
branches:
- master
pull_request:
permissions:
deployments: write
issues: write
pull-requests: write
statuses: write
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
# - name: Set Swap Space
# uses: pierotofy/set-swap-space@master
# with:
# swap-size-gb: 6
- name: Checkout
uses: actions/checkout@v4
with:
# Fetches all commit history for a single branch. We need commit
# history for accurate "last updated" dates on each page, but fetch
# depth of 0 would fetch all branches which is slow.
# https://github.com/actions/checkout/issues/520#issuecomment-1320838255
fetch-depth: 2147483647
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Cache Webpack Build
uses: actions/cache@v4
env:
TAR_OPTIONS: "--remove-files"
with:
path: node_modules/.cache/rspack
key: cache-webpack-${{ github.base_ref || github.ref_name }}
- name: Install Dependencies
run: npm ci --omit=dev
- name: Build with Docusaurus
run: npm run build
- name: Deploy to Netlify
id: deploy
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
uses: nwtgck/actions-netlify@v3
with:
publish-dir: build
production-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: true
enable-commit-comment: false
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Compress Build Archive
if: ${{ steps.deploy.conclusion == 'skipped' }}
run: tar --label=${{ github.event.pull_request.number }} --remove-files --zstd -cf build.tar.zst build
- name: Upload Build Artifact
if: ${{ steps.deploy.conclusion == 'skipped' }}
uses: actions/upload-artifact@v4
with:
name: preview-build
path: build.tar.zst
retention-days: 1