Skip to content

Commit 3f5e1a0

Browse files
committed
Use official GitHub Actions for live viewer deployment
1 parent bd27527 commit 3f5e1a0

File tree

4 files changed

+44
-22
lines changed

4 files changed

+44
-22
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
name: Build
22
on:
33
pull_request:
4-
branches:
5-
- main
4+
branches: [main]
65
push:
7-
branches:
8-
- main
6+
branches: [main]
97
jobs:
108
build:
119
name: Lint and tests
@@ -25,19 +23,3 @@ jobs:
2523
- run: npm ci
2624
- run: npm run lint
2725
- run: npm test
28-
deploy:
29-
name: Live viewer
30-
needs: build
31-
runs-on: ubuntu-latest
32-
steps:
33-
- uses: actions/checkout@v4
34-
- uses: actions/setup-node@v4
35-
- run: npm ci
36-
- name: Build Live Viewer
37-
run: bash scripts/deploy-live-viewer.sh
38-
- name: Push to gh-pages
39-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
40-
uses: peaceiris/actions-gh-pages@v3
41-
with:
42-
github_token: ${{ secrets.GITHUB_TOKEN }}
43-
publish_dir: ./out

.github/workflows/deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Live Viewer
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: pages
14+
cancel-in-progress: false
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-node@v4
22+
- run: npm ci
23+
- name: Setup Pages
24+
id: pages
25+
uses: actions/configure-pages@v3
26+
- name: Build into _site
27+
run: bash scripts/deploy-live-viewer.sh
28+
- name: Upload artifact
29+
uses: actions/upload-pages-artifact@v2
30+
deploy:
31+
runs-on: ubuntu-latest
32+
needs: build
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
36+
steps:
37+
- name: Deploy to GitHub Pages
38+
id: deployment
39+
uses: actions/deploy-pages@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ lib/Function.js
1212
lib/URL.js
1313
lib/URLSearchParams.js
1414
lib/utils.js
15+
_site/

scripts/deploy-live-viewer.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ cd "$(dirname "$0")"
66

77
npm run build-live-viewer
88

9-
mkdir -p ../out
10-
cp -r ../live-viewer/* ../out # exclude files starting with . by using /*
9+
mkdir -p ../_site
10+
cp -r ../live-viewer/* ../_site # exclude files starting with . by using /*

0 commit comments

Comments
 (0)