Skip to content

Commit b5884b5

Browse files
committed
build: add github actions to publish demo to github pages
1 parent 3bda185 commit b5884b5

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: monthly
7+
open-pull-requests-limit: 10

.github/workflows/node.js.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-22.04
16+
17+
strategy:
18+
matrix:
19+
node-version: [18.x, 20.x, 21.x]
20+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21+
22+
steps:
23+
- name: Check out
24+
uses: actions/checkout@v3
25+
26+
- name: Use Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: 'npm'
31+
32+
- run: npm ci
33+
- run: npm run build --if-present
34+
- run: npm run lint
35+
- run: npm test

.github/workflows/publish-demo.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: publish-demo-to-github-pages
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-22.04
11+
12+
strategy:
13+
matrix:
14+
node-version: [20.x]
15+
16+
steps:
17+
- name: Check out
18+
uses: actions/checkout@v3
19+
20+
- name: Use Node ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: 'npm'
25+
26+
- name: npm ci and npm run build
27+
run: |
28+
npm ci
29+
npm run build:ghpages
30+
31+
- name: Publish current workdir (which contains generated content) to GitHub Pages
32+
uses: rayluo/[email protected]
33+
with:
34+
# Optional. Default value "." means the root directory of your project will be published.
35+
# You can use whatever directory your project uses, for example "wwwroot".
36+
# Such a directory does *not* have to already exist in your repo,
37+
# it could be an output directory created dynamically by your static website builder.
38+
source-directory: ghpages
39+
40+
# Optional. Default value "gh_pages".
41+
# It specifies the temporary branch which hosts the static website.
42+
# Each build will OVERWRITE this branch.
43+
target-branch: gh_pages

0 commit comments

Comments
 (0)