-
-
Notifications
You must be signed in to change notification settings - Fork 32
47 lines (45 loc) · 1.49 KB
/
publish-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
name: Publish docs to GitHub Pages
on:
workflow_call:
inputs:
destination_dir:
required: true
type: string
secrets:
PUBLISH_DOCS_TOKEN:
required: true
jobs:
publish-docs-to-gh-pages:
name: Publish docs to GitHub Pages
runs-on: ubuntu-latest
environment: github-pages
permissions:
contents: write
steps:
- name: Ensure `destination_dir` is not empty
if: ${{ inputs.destination_dir == '' }}
run: exit 1
- uses: actions/checkout@v4
- name: Install Corepack via Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install Yarn
run: corepack enable
- name: Restore Yarn cache
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies via Yarn
run: yarn --immutable
- name: Run build script
run: yarn build:docs
- name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch
uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935
with:
# This `PUBLISH_DOCS_TOKEN` needs to be manually set per-repository.
# Look in the repository settings under "Environments", and set this token in the `github-pages` environment.
personal_token: ${{ secrets.PUBLISH_DOCS_TOKEN }}
publish_dir: ./docs
destination_dir: ${{ inputs.destination_dir }}