-
Notifications
You must be signed in to change notification settings - Fork 262
79 lines (58 loc) · 2.78 KB
/
preview-docs.yaml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Preview Docs
on: pull_request
jobs:
run:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v3
- name: Setup Node.js v20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9.1.2
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Create .env.production.local file for apps/backend
run: cp apps/backend/.env.development apps/backend/.env.production.local
- name: Create .env.production.local file for apps/dashboard
run: cp apps/dashboard/.env.development apps/dashboard/.env.production.local
- name: Create .env.production.local file for apps/e2e
run: cp apps/e2e/.env.development apps/e2e/.env.production.local
- name: Create .env.production.local file for examples/cjs-test
run: cp examples/cjs-test/.env.development examples/cjs-test/.env.production.local
- name: Create .env.production.local file for examples/demo
run: cp examples/demo/.env.development examples/demo/.env.production.local
- name: Create .env.production.local file for examples/docs-examples
run: cp examples/docs-examples/.env.development examples/docs-examples/.env.production.local
- name: Create .env.production.local file for examples/e-commerce
run: cp examples/e-commerce/.env.development examples/e-commerce/.env.production.local
- name: Create .env.production.local file for examples/middleware
run: cp examples/middleware/.env.development examples/middleware/.env.production.local
- name: Create .env.production.local file for examples/partial-prerendering
run: cp examples/partial-prerendering/.env.development examples/partial-prerendering/.env.production.local
- name: Create .env.production.local file for examples/supabase
run: cp examples/supabase/.env.development examples/supabase/.env.production.local
- name: Build
run: pnpm build
env:
QUETZAL_API_KEY: ${{ secrets.QUETZAL_API_KEY }}
- name: Check API is valid
run: pnpm run fern check
- name: Generate preview URL
id: generate-docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
OUTPUT=$(pnpm run fern generate --docs --preview 2>&1) || true
echo "$OUTPUT"
URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()')
echo "Preview URL: $URL"
echo "🌿 Preview your docs: $URL" > docs_preview_url.untracked.txt
- name: Comment URL in PR
uses: thollander/[email protected]
with:
filePath: docs_preview_url.untracked.txt