Skip to content

Commit f1bec50

Browse files
author
Chris E
committed
feat: github pages
1 parent 4fbdad7 commit f1bec50

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
jobs:
8+
build_site:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
# If you're using pnpm, add this step then change the commands and cache key below to use `pnpm`
15+
# - name: Install pnpm
16+
# uses: pnpm/action-setup@v3
17+
# with:
18+
# version: 8
19+
20+
- name: Install Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: npm
25+
26+
- name: Install dependencies
27+
run: npm i
28+
29+
- name: build
30+
env:
31+
BASE_PATH: "/${{ github.event.repository.name }}"
32+
run: |
33+
npm run build
34+
35+
- name: Upload Artifacts
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
# this should match the `pages` option in your adapter-static options
39+
path: "build/"
40+
41+
deploy:
42+
needs: build_site
43+
runs-on: ubuntu-latest
44+
45+
permissions:
46+
pages: write
47+
id-token: write
48+
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
53+
steps:
54+
- name: Deploy
55+
id: deployment
56+
uses: actions/deploy-pages@v4

src/routes/+layout.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import favicon from '$lib/assets/favicon.svg';
44
55
let { children } = $props();
6+
7+
export const prerender = true;
68
</script>
79

810
<svelte:head><link rel="icon" href={favicon} /></svelte:head>

svelte.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ const config = {
99

1010
kit: {
1111
adapter: adapter({
12-
fallback: 'index.html'
13-
})
12+
fallback: '404.html'
13+
}),
14+
paths: {
15+
base: process.argv.includes('dev') ? '' : process.env.BASE_PATH
16+
}
1417
}
1518
};
1619

0 commit comments

Comments
 (0)