-
-
Notifications
You must be signed in to change notification settings - Fork 15
64 lines (56 loc) · 1.76 KB
/
preview.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Deploy PR previews
concurrency: preview-${{ github.ref }}
on:
pull_request:
types:
- opened
- reopened
- synchronize
paths:
- 'website/**'
jobs:
deploy-preview:
# If it's a PR from within the same repo, deploy to a preview page
if: github.repository_owner == 'batijs' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build dependencies
run: pnpm run build
- name: Build website
run: pnpm run build:pages
working-directory: website
env:
BASE: /pr-preview/pr-${{ github.event.number }}/
- uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./website/dist/client
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
token: ${{ secrets.DEPLOY_GITHUB_TOKEN }}
deploy-repository: batijs/batijs.github.io
custom-url: batijs.dev