Skip to content

Commit dd613de

Browse files
authored
Add GitHub Actions workflow for PR previews
1 parent 792e6d5 commit dd613de

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/preview.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: PR Preview
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, closed]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
deploy-preview:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
if: github.event.action != 'closed'
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
cache: 'npm'
26+
if: github.event.action != 'closed'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
if: github.event.action != 'closed'
31+
32+
- name: Build
33+
run: npm run build
34+
if: github.event.action != 'closed'
35+
36+
- name: Deploy PR Preview
37+
uses: rossjrw/pr-preview-action@v1
38+
with:
39+
source-dir: ./dist
40+
preview-branch: gh-pages
41+
umbrella-dir: pr-preview
42+
action: auto

0 commit comments

Comments
 (0)