-
Notifications
You must be signed in to change notification settings - Fork 625
49 lines (41 loc) · 1.47 KB
/
update_gh_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
# This workflow updates GitHub Pages on the repo it is run from.
name: Update GitHub Pages
on:
workflow_dispatch: # Manually trigger. Colon is required.
inputs:
branch:
description: 'Branch to publish from'
required: true
default: 'master'
type: string
workflow_call: # Allow this workflow to be called from publish workflow.
permissions:
contents: write # For checkout and push.
jobs:
update-github-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch || 'master' }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
- name: NPM install
# Use CI so that we don't update dependencies in this step.
# TODO(#1511): remove --force flag from installing examples
# Until then, don't block updating just because some dependencies are out of date.
run: |
npm ci
(cd examples && npm ci --force)
- name: Deploy to GH Pages
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# deploys to the current repo,
# so you can use this workflow from a fork to update your personal gh-pages
run: |
npm run deploy:prepare
git remote set-url origin https://git:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npx gh-pages -d gh-pages -t -u "github-actions-bot <support+actions@github.com>"