-
Notifications
You must be signed in to change notification settings - Fork 93
56 lines (50 loc) · 1.68 KB
/
preview.yml
File metadata and controls
56 lines (50 loc) · 1.68 KB
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
50
51
52
53
54
55
56
# .github/workflows/preview.yml
name: Deploy PR previews
permissions:
contents: read
concurrency:
group: preview-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
jobs:
deploy-preview:
runs-on: ubuntu-latest
if: |
github.actor != 'dependabot[bot]' &&
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: write # Required for pr-preview-action to push to gh-pages
pull-requests: write # Required for PR comments
steps:
- name: Cached LFS checkout
uses: nschloe/action-cached-lfs-checkout@385a8ecc719e50b8c71af6ab01a624b486b7c3bc
- name: Set up node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build website
run: npm run build
env:
BASE_URL: /pr-preview/pr-${{ github.event.number }}
- name: Deploy preview
uses: rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9
id: preview-step
with:
source-dir: ./build/
- name: Publish preview link to job summary
if: steps['preview-step'].outputs['deployment-action'] == 'deploy'
run: |
url="${{ steps['preview-step'].outputs['preview-url'] }}"
echo "Preview visible at ${url}" >> "$GITHUB_STEP_SUMMARY"
echo "[Open preview](${url})" >> "$GITHUB_STEP_SUMMARY"