Skip to content

Commit 0b970c0

Browse files
felixtrzmeta-codesync[bot]
authored andcommitted
fix(starter-assets): update asset paths to use relative paths and improve GitHub Pages deployment
Summary: - **Asset paths**: Changed all asset URLs from absolute paths (`/gltf/...`, `/ui/...`, `/audio/...`) to relative paths (`./gltf/...`, `./ui/...`, `./audio/...`) for better portability - **GitHub Actions workflow**: Updated deployment to use official `actions/upload-pages-artifact` and `actions/deploy-pages` instead of third-party action - **Workflow permissions**: Added explicit permissions for `contents`, `pages`, and `id-token` for secure deployment - **Manual trigger**: Added `workflow_dispatch` to allow manual workflow runs - **Documentation cleanup**: Removed references to non-existent chapters 9 and 10 from build guide - **Code formatting**: Minor formatting improvement in panel.ts early return statement Reviewed By: zjm-meta Differential Revision: D88116986 Privacy Context Container: L1334777 fbshipit-source-id: f48e2e0ee4b40c8c5bd047037f6fe428d7b18e2d
1 parent 9ccab88 commit 0b970c0

5 files changed

Lines changed: 28 additions & 22 deletions

File tree

docs/guides/08-build-deploy.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,14 @@ name: Deploy to GitHub Pages
138138

139139
on:
140140
push:
141-
branches: [main]
141+
branches: ['main']
142+
143+
workflow_dispatch:
144+
145+
permissions:
146+
contents: read
147+
pages: write
148+
id-token: write
142149

143150
jobs:
144151
build-and-deploy:
@@ -160,12 +167,14 @@ jobs:
160167
- name: Build
161168
run: npm run build
162169

163-
- name: Deploy to GitHub Pages
164-
uses: peaceiris/actions-gh-pages@v4
165-
if: github.ref == 'refs/heads/main'
170+
- name: Upload artifact
171+
uses: actions/upload-pages-artifact@v3
166172
with:
167-
github_token: ${{ secrets.GITHUB_TOKEN }}
168-
publish_dir: ./dist
173+
path: './dist'
174+
175+
- name: Deploy to GitHub Pages
176+
id: deployment
177+
uses: actions/deploy-pages@v4
169178
```
170179
171180
## What's Next?
@@ -178,11 +187,6 @@ Throughout this tutorial, you've learned how to:
178187
- Create professional environments with lighting and backgrounds
179188
- Build interactive experiences with grabbing and locomotion
180189
- Develop custom systems and components using ECS architecture
181-
- Build and deploy optimized WebXR applications
182-
183-
For developers ready to dive deeper into advanced IWSDK development, continue with:
184-
185-
- **Chapter 9**: Advanced Topics - Explore physics simulation, scene understanding, and performance optimization
186-
- **Chapter 10**: Production Patterns - Learn enterprise-level development practices, testing strategies, and deployment pipelines
190+
- Build and deploy IWSDK applications
187191
188192
You now have the foundation to create professional WebXR experiences with IWSDK!

packages/starter-assets/starter-template/metaspatial-ar/Composition/Main.scene

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ entities:
7474
com.iwsdk.components.Interactable:
7575
{}
7676
com.iwsdk.components.PanelUI:
77-
config: /ui/welcome.uikitml
77+
config: ./ui/welcome.uikitml
7878
com.iwsdk.components.ScreenSpace:
7979
height: 40%
8080
top: 20px

packages/starter-assets/starter-template/metaspatial-vr/Composition/Main.scene

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ entities:
106106
com.iwsdk.components.Interactable:
107107
{}
108108
com.iwsdk.components.PanelUI:
109-
config: /ui/welcome.uikitml
109+
config: ./ui/welcome.uikitml
110110
com.iwsdk.components.ScreenSpace:
111111
left: 20px
112112
top: 20px

packages/starter-assets/starter-template/src/index.template.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ const assets: AssetManifest = {
5050
// @assets-manual-start
5151
// @assets-envdesk-start
5252
environmentDesk: {
53-
url: '/gltf/environmentDesk/environmentDesk.gltf',
53+
url: './gltf/environmentDesk/environmentDesk.gltf',
5454
type: AssetType.GLTF,
5555
priority: 'critical',
5656
},
5757
// @assets-envdesk-end
5858
plantSansevieria: {
59-
url: '/gltf/plantSansevieria/plantSansevieria.gltf',
59+
url: './gltf/plantSansevieria/plantSansevieria.gltf',
6060
type: AssetType.GLTF,
6161
priority: 'critical',
6262
},
6363
robot: {
64-
url: '/gltf/robot/robot.gltf',
64+
url: './gltf/robot/robot.gltf',
6565
type: AssetType.GLTF,
6666
priority: 'critical',
6767
},
@@ -78,7 +78,7 @@ World.create(document.getElementById('scene-container') as HTMLDivElement, {
7878
},
7979
features: {} /* @chef:app */,
8080
/* @template:if kind='metaspatial' */ level:
81-
'/glxf/Composition.glxf' /* @template:end */,
81+
'./glxf/Composition.glxf' /* @template:end */,
8282
}).then((world) => {
8383
const { camera } = world;
8484
/* @template:if mode='ar' */
@@ -127,15 +127,15 @@ World.create(document.getElementById('scene-container') as HTMLDivElement, {
127127
.addComponent(Interactable)
128128
.addComponent(Robot)
129129
.addComponent(AudioSource, {
130-
src: '/audio/chime.mp3',
130+
src: './audio/chime.mp3',
131131
maxInstances: 3,
132132
playbackMode: PlaybackMode.FadeRestart,
133133
});
134134

135135
const panelEntity = world
136136
.createTransformEntity()
137137
.addComponent(PanelUI, {
138-
config: '/ui/welcome.json',
138+
config: './ui/welcome.json',
139139
maxHeight: 0.8,
140140
maxWidth: 1.6,
141141
})

packages/starter-assets/starter-template/src/panel.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@ import {
1818
export class PanelSystem extends createSystem({
1919
welcomePanel: {
2020
required: [PanelUI, PanelDocument],
21-
where: [eq(PanelUI, 'config', '/ui/welcome.json')],
21+
where: [eq(PanelUI, 'config', './ui/welcome.json')],
2222
},
2323
}) {
2424
init() {
2525
this.queries.welcomePanel.subscribe('qualify', (entity) => {
2626
const document = PanelDocument.data.document[
2727
entity.index
2828
] as UIKitDocument;
29-
if (!document) return;
29+
if (!document) {
30+
return;
31+
}
3032

3133
const xrButton = document.getElementById('xr-button') as UIKit.Text;
3234
xrButton.addEventListener('click', () => {

0 commit comments

Comments
 (0)