-
Notifications
You must be signed in to change notification settings - Fork 562
49 lines (47 loc) · 1.41 KB
/
publish-github-pages.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
name: Publish to GitHub Pages
on:
workflow_call:
inputs:
build_script:
required: true
type: string
destination_dir:
required: true
type: string
publish_dir:
required: true
type: string
secrets:
PUBLISH_PAGES_TOKEN:
required: true
jobs:
publish-environment:
name: Publish to GitHub Pages
runs-on: ubuntu-latest
environment: github-pages
permissions:
contents: write
steps:
- name: Ensure `build_script` is not empty
if: ${{ inputs.destination_dir == '' }}
run: exit 1
- name: Ensure `destination_dir` is not empty
if: ${{ inputs.destination_dir == '' }}
run: exit 1
- name: Ensure `publish_dir` is not empty
if: ${{ inputs.publish_dir == '' }}
run: exit 1
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: yarn --immutable
- name: Run build script
run: ${{ inputs.build_script }}
- name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch
uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935
with:
personal_token: ${{ secrets.PUBLISH_PAGES_TOKEN }}
publish_dir: ${{ inputs.publish_dir }}
destination_dir: ${{ inputs.destination_dir }}