-
Notifications
You must be signed in to change notification settings - Fork 20
58 lines (47 loc) · 1.29 KB
/
preview-build.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
name: Preview Build
on:
pull_request:
types: [opened, synchronize, reopened]
# Cancel previous CI if the PR is updated.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-site:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.6.0
- name: Build site
env:
SITE_ENV: development
run: |
pnpm install
pnpm run site:build
# avoid deploy failed by `:id` directory
# ref: https://github.com/actions/upload-artifact/issues/85
- name: Remove dynamic route path
run: |
rm -rf site/~demos/:id
- name: Upload site artifact
uses: actions/upload-artifact@v3
with:
name: site
path: site/
retention-days: 5
# Upload PR id for next workflow use
- name: Save PR id
if: ${{ always() }}
run: echo ${{ github.event.number }} > ./pr-id.txt
- name: Upload PR id
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: pr
path: ./pr-id.txt