-
-
Notifications
You must be signed in to change notification settings - Fork 198
200 lines (176 loc) · 6.26 KB
/
static.yml
File metadata and controls
200 lines (176 loc) · 6.26 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: Deploy Static Files
on:
push:
branches:
- main
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 22
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 10
run_install: true
- name: Generate Docs
run: pnpm -r generate:docs
- id: configurepages
uses: actions/configure-pages@v5
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#example-of-setting-an-output-parameter
- id: set-base-path
run: echo "BASE_PATH=${{ '/xr/docs' || steps.configurepages.outputs.base_path }}" >> "$GITHUB_OUTPUT"
- run: |
set -ex
docker run --rm --init \
-v "./$MDX":/app/docs \
-e BASE_PATH \
-e DIST_DIR="$MDX/out$BASE_PATH" \
-e MDX \
-e NEXT_PUBLIC_LIBNAME \
-e NEXT_PUBLIC_LIBNAME_SHORT \
-e NEXT_PUBLIC_LIBNAME_DOTSUFFIX_LABEL \
-e NEXT_PUBLIC_LIBNAME_DOTSUFFIX_HREF \
-e OUTPUT=export \
-e HOME_REDIRECT \
-e MDX_BASEURL \
-e SOURCECODE_BASEURL \
-e EDIT_BASEURL \
-e NEXT_PUBLIC_URL \
-e ICON \
-e LOGO \
-e GITHUB \
-e DISCORD \
-e THEME_PRIMARY \
-e THEME_SCHEME \
-e THEME_CONTRAST \
-e THEME_NOTE \
-e THEME_TIP \
-e THEME_IMPORTANT \
-e THEME_WARNING \
-e THEME_CAUTION \
-e CONTRIBUTORS_PAT \
ghcr.io/pmndrs/docs:2 npm run build
env:
BASE_PATH: ${{ steps.set-base-path.outputs.BASE_PATH }}
MDX: 'docs'
NEXT_PUBLIC_LIBNAME: 'xr'
NEXT_PUBLIC_LIBNAME_SHORT: ''
NEXT_PUBLIC_LIBNAME_DOTSUFFIX_LABEL: 'docs'
NEXT_PUBLIC_LIBNAME_DOTSUFFIX_HREF: 'https://docs.pmnd.rs'
HOME_REDIRECT: '/getting-started/introduction'
MDX_BASEURL: 'https://github.com/${{ github.repository }}/raw/${{ github.ref_name }}/docs'
SOURCECODE_BASEURL: 'https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}'
EDIT_BASEURL: 'https://github.com/${{ github.repository }}/edit/${{ github.ref_name }}/docs'
NEXT_PUBLIC_URL: ${{ steps.configurepages.outputs.base_url }}
ICON: '🤳'
LOGO: '/logo.png'
GITHUB: 'https://github.com/pmndrs/xr'
DISCORD: ''
THEME_PRIMARY: '#323e48'
THEME_SCHEME: 'tonalSpot'
THEME_CONTRAST: '0'
THEME_NOTE: '#1f6feb'
THEME_TIP: '#238636'
THEME_IMPORTANT: '#8957e5'
THEME_WARNING: '#d29922'
THEME_CAUTION: '#da3633'
CONTRIBUTORS_PAT: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-pages-artifact@v3
with:
path: docs/out${{ steps.set-base-path.outputs.BASE_PATH }}
examples:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 22
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 10
run_install: true
# Generate Docs with TypeDoc
- name: Generate Docs
run: pnpm -r generate_docs
# Examples
- name: Building Examples
run: pnpm -r build
- name: Copy Examples
run: |
mkdir -p public/examples/minecraft
mkdir -p public/examples/pingpong
mkdir -p public/examples/rag-doll
mkdir -p public/examples/stage
mkdir -p public/examples/watch
mkdir -p public/examples/room-with-shadows
mkdir -p public/examples/layers
mkdir -p public/examples/secondary-input-sources
mkdir -p public/examples/editor
mkdir -p public/examples/hit-testing
mkdir -p public/examples/uikit
mkdir -p public/examples/portal
cp -r ./examples/minecraft/dist/* ./public/examples/minecraft
cp -r ./examples/pingpong/dist/* ./public/examples/pingpong
cp -r ./examples/rag-doll/dist/* ./public/examples/rag-doll
cp -r ./examples/stage/dist/* ./public/examples/stage
cp -r ./examples/watch/dist/* ./public/examples/watch
cp -r ./examples/room-with-shadows/dist/* ./public/examples/room-with-shadows
cp -r ./examples/layers/dist/* ./public/examples/layers
cp -r ./examples/secondary-input-sources/dist/* ./public/examples/secondary-input-sources
cp -r ./examples/editor/dist/* ./public/examples/editor
cp -r ./examples/hit-testing/dist/* ./public/examples/hit-testing
cp -r ./examples/uikit/dist/* ./public/examples/uikit
cp -r ./examples/portal/dist/* ./public/examples/portal
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: examples
path: public/examples/
bundle-artifacts:
runs-on: ubuntu-latest
needs:
- docs
- examples
steps:
- name: Download Examples Artifiact
uses: actions/download-artifact@v4
with:
name: examples
path: ./examples
- name: Download Docs Artifiact
uses: actions/download-artifact@v4
with:
name: github-pages
path: ./docs
- name: Extract Docs
run: tar -xf ./docs/artifact.tar -C ./docs/
- name: Create deploy.tar
run: tar -cf deploy.tar ./*
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: deploy
path: ./deploy.tar
deploy:
needs: bundle-artifacts
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: deploy