-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (80 loc) · 2.64 KB
/
Copy pathdocs.yml
File metadata and controls
87 lines (80 loc) · 2.64 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
name: Documentation Action
on:
workflow_call:
inputs:
deploy:
description: "Optional flag to deploy documentation using deploy script"
required: false
type: boolean
default: true
default-branch:
description: "Optional default branch to target for release"
required: false
type: string
default: "main"
runs-on:
description: "Optional label for the runner to run on"
required: false
type: string
default: "['self-hosted', 'Linux', 'X64']"
node-version:
description: "Optional Node.js version to use"
required: false
type: string
default: "21.x"
working-directory:
description: "Optional working directory"
required: false
type: string
default: "docs"
committer-email:
description: "Optional committer email"
required: false
type: string
default: "47529956+alwyn974@users.noreply.github.com"
committer-name:
description: "Optional committer user/name"
required: false
type: string
default: "alwyn974"
jobs:
build:
name: Build Documentation
runs-on: ${{ fromJSON(inputs.runs-on) }}
permissions:
contents: write
id-token: write
env:
node-version: ${{ inputs.node-version }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
with:
run_install: false
- name: Setup Node.js ${{ env.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: ${{ env.node-version }}
cache: 'pnpm'
- name: Install dependencies
working-directory: ${{ inputs.working-directory }}
run: |
pnpm install
- name: Build documentation
working-directory: ${{ inputs.working-directory }}
run: |
pnpm build
- name: Deploy documentation
if: github.event_name != 'pull_request' && inputs.deploy == true && (startsWith(github.ref, 'refs/tags/docs-v') || github.ref == format('refs/heads/{0}', inputs.default-branch))
working-directory: ${{ inputs.working-directory }}
env:
GIT_USER: ${{ inputs.committer-name }}
GIT_USER_NAME: ${{ inputs.committer-name }}
GIT_USER_EMAIL: ${{ inputs.committer-email }}
GIT_PASS: ${{ secrets.GITHUB_TOKEN }}
run: |
pnpm run deploy