-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (72 loc) · 2.19 KB
/
docs.yml
File metadata and controls
88 lines (72 loc) · 2.19 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
name: Build and deploy documentation
on:
workflow_call:
inputs:
build-path:
required: false
default: '.'
type: string
deploy:
required: false
default: false
type: boolean
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.build-path }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
cache: npm
cache-dependency-path: ${{ inputs.build-path }}/package-lock.json
- name: Install dependencies
run: npm ci
- name: Check formatting
run: npm run format:check
- name: Configure GitHub Pages
id: pages
uses: actions/configure-pages@v5
- name: Build static site
run: |
npm run build -- \
--site "${{ steps.pages.outputs.base_url }}" \
--base "${{ steps.pages.outputs.base_path }}"
- name: Move build artifacts
# This is a workaround. The link checking tool we're using does not support.
# We need to create a directory structure that matches URLs in the generated HTML.
# For example, if the page is deployed to user.github.io/repo-name, all HTML files
# need to be moved to `dist/repo-name`.
run: |
if [ -n "${{ steps.pages.outputs.base_path }}" ];
then
mv ./dist ./dist-tmp
mkdir ./dist
mv ./dist-tmp ./dist/${{ steps.pages.outputs.base_path }}
fi
- name: Check links
run: npm run links -- --github-actions
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ inputs.build-path }}/dist/${{ steps.pages.outputs.base_path }}
deploy:
if: ${{ inputs.deploy }}
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4