Skip to content

Commit 758b89f

Browse files
committed
refactor: update GitHub Actions workflow for SvelteKit deployment, improving clarity and consistency
Refactors GitHub Pages workflow for SvelteKit Updates the GitHub Actions workflow to streamline SvelteKit deployment. - Switches from Deno to Node.js for improved compatibility and ease of use. - Simplifies the workflow configuration for better readability.
1 parent be79f44 commit 758b89f

1 file changed

Lines changed: 21 additions & 25 deletions

File tree

.github/workflows/pages.yml

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
name: Deploy SvelteKit Site to GitHub Pages (with Deno)
1+
name: Deploy SvelteKit to GitHub Pages
22

33
on:
44
push:
5-
branches: ["main"] # Trigger deployment on pushes to the main branch
6-
workflow_dispatch: # Allows manual triggering
5+
branches:
6+
- main
7+
workflow_dispatch:
78

8-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
99
permissions:
1010
contents: read
1111
pages: write
1212
id-token: write
1313

14-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
15-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
1614
concurrency:
1715
group: "pages"
1816
cancel-in-progress: false
@@ -21,45 +19,43 @@ jobs:
2119
build:
2220
runs-on: ubuntu-latest
2321
steps:
24-
- name: Checkout
22+
- name: Checkout repository
2523
uses: actions/checkout@v4
2624

27-
- name: Setup Deno
28-
uses: denoland/setup-deno@v2
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
2927
with:
30-
deno-version: v2.1.4
28+
node-version: '20'
29+
cache: 'npm'
3130

32-
- name: Install Dependencies
33-
# Use Deno to run npm install. Adjust if you use pnpm or yarn.
34-
run: deno run -A npm:npm install
31+
- name: Install dependencies
32+
run: npm install
3533

36-
- name: Build SvelteKit Site
37-
# Use Deno to run npm run build.
38-
# Set the VITE_BASE_PATH environment variable for GitHub Pages sub-paths.
39-
run: deno run -A npm:npm run build
34+
- name: Build the site
35+
run: npm run build
4036
env:
41-
VITE_BASE_PATH: /${{ github.event.repository.name }} # Set this to your repo name!
42-
37+
NODE_ENV: production
4338
- name: Create .nojekyll file
4439
# Prevents GitHub Pages from running built files through Jekyll
4540
run: touch build/.nojekyll
4641

4742
- name: Setup Pages
48-
uses: actions/configure-pages@v5
43+
uses: actions/configure-pages@v5
4944

50-
- name of: Upload artifact
45+
- name: Upload artifact
5146
uses: actions/upload-pages-artifact@v3
5247
with:
53-
# Upload the 'build' directory (or whatever you set in svelte.config.js)
5448
path: './build'
5549

5650
deploy:
51+
needs: build
52+
runs-on: ubuntu-latest
5753
environment:
5854
name: github-pages
5955
url: ${{ steps.deployment.outputs.page_url }}
60-
runs-on: ubuntu-latest
61-
needs: build # This job runs only after the 'build' job succeeds
6256
steps:
6357
- name: Deploy to GitHub Pages
6458
id: deployment
65-
uses: actions/deploy-pages@v4
59+
uses: actions/deploy-pages@v4
60+
61+

0 commit comments

Comments
 (0)