-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (87 loc) · 2.65 KB
/
deploy-examples.yml
File metadata and controls
102 lines (87 loc) · 2.65 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Deploy Examples to GitHub Pages
on:
push:
branches: [main]
paths:
- 'examples/react/**'
- 'src/**'
- '.github/workflows/deploy-examples.yml'
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
build:
name: Build Example App
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache SDK dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
key: ${{ runner.os }}-bun-sdk-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-sdk-
${{ runner.os }}-bun-
- name: Install SDK dependencies
run: bun install --frozen-lockfile
working-directory: .
- name: Build SDK
run: bun run build
working-directory: .
- name: Generate API docs JSON
run: bun node_modules/typedoc/bin/typedoc --json examples/react/app/data/api-docs.json --emit none
working-directory: .
- name: Cache example dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
examples/react/node_modules
key: ${{ runner.os }}-bun-examples-${{ hashFiles('examples/react/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-examples-
${{ runner.os }}-bun-
- name: Install example dependencies
run: bun install --frozen-lockfile
working-directory: examples/react
- name: Build example app
run: bun run build
working-directory: examples/react
env:
NODE_ENV: production
VITE_PUBLIC_POSTHOG_KEY: ${{ secrets.VITE_PUBLIC_POSTHOG_KEY }}
VITE_PUBLIC_POSTHOG_HOST: ${{ secrets.VITE_PUBLIC_POSTHOG_HOST }}
- name: Prepare deployment directory
run: |
mkdir -p _site
cp -r examples/react/build/client/* _site/
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site
deploy:
name: Deploy to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4