-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (44 loc) · 1.58 KB
/
deploy.yml
File metadata and controls
53 lines (44 loc) · 1.58 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
name: Deploy to GitHub Pages
on:
push:
branches:
- main # Or your default branch
workflow_dispatch: # Allows manual triggering
permissions:
contents: read
pages: write
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest # or a specific version
- name: Install dependencies
run: bun install --frozen-lockfile
# IMPORTANT: Replace 'REPLACE_WITH_YOUR_REPO_NAME' in svelte.config.js and vite.config.ts
# if you haven't done so manually before this action runs.
# This step is a fallback if you want the action to handle it.
# If you manage this manually or through other means, you can remove this step.
- name: Set base path for GitHub Pages
run: |
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2)
echo "Repository name: $REPO_NAME"
sed -i "s|REPLACE_WITH_YOUR_REPO_NAME|$REPO_NAME|g" svelte.config.js
sed -i "s|REPLACE_WITH_YOUR_REPO_NAME|$REPO_NAME|g" vite.config.ts
shell: bash
- name: Build project
run: bun run build
env:
NODE_ENV: production # Ensures correct base path is used by svelte.config.js and vite.config.ts
- name: Upload artifact to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: ./build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4