Skip to content

Commit ff47e93

Browse files
committed
Add GitHub Pages deployment
1 parent 00d35b8 commit ff47e93

7 files changed

Lines changed: 3942 additions & 19 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: 'pages'
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Build
34+
run: npm run build
35+
36+
- name: Setup Pages
37+
uses: actions/configure-pages@v4
38+
39+
- name: Upload artifact
40+
uses: actions/upload-pages-artifact@v3
41+
with:
42+
path: './dist'
43+
44+
deploy:
45+
environment:
46+
name: github-pages
47+
url: ${{ steps.deployment.outputs.page_url }}
48+
runs-on: ubuntu-latest
49+
needs: build
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

dist/assets/index-BAhK2AtN.js

Lines changed: 3840 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Threejs basics</title>
7+
<style>
8+
* {
9+
margin: 0;
10+
padding: 0;
11+
box-sizing: border-box;
12+
}
13+
body,
14+
html {
15+
overflow: hidden;
16+
}
17+
</style>
18+
<script type="module" crossorigin src="/threejs-3d-car-viewer/assets/index-BAhK2AtN.js"></script>
19+
</head>
20+
<body>
21+
<canvas id="myCanvas"></canvas>
22+
23+
</body>
24+
</html>

dist/models/car.glb

19.6 MB
Binary file not shown.

index.html

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Threejs basics</title>
77
<style>
8-
*{
9-
margin: 0;
10-
padding: 0;
11-
box-sizing: border-box;
12-
}
13-
body,html{
14-
15-
overflow: hidden;
16-
}
8+
* {
9+
margin: 0;
10+
padding: 0;
11+
box-sizing: border-box;
12+
}
13+
body,
14+
html {
15+
overflow: hidden;
16+
}
1717
</style>
18-
</head>
19-
<body>
20-
18+
</head>
19+
<body>
2120
<canvas id="myCanvas"></canvas>
2221

23-
<script type="module" src="/main.js"></script>
24-
25-
</body>
22+
<script type="module" src="./main.js"></script>
23+
</body>
2624
</html>

main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ controls.keyPanSpeed = 7.0;
5454
const loader = new GLTFLoader();
5555
let model3D;
5656
loader.load(
57-
"/models/car.glb",
57+
"./models/car.glb",
5858
(gltf) => {
5959
model3D = gltf.scene;
6060
model3D.position.set(0, 0, 0);

vite.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig } from 'vite'
2+
3+
export default defineConfig({
4+
base: '/threejs-3d-car-viewer/', // Your GitHub repo name
5+
build: {
6+
outDir: 'dist',
7+
},
8+
})

0 commit comments

Comments
 (0)