Skip to content

Commit 16c41ca

Browse files
committed
try deno
1 parent 0a9b04a commit 16c41ca

File tree

5 files changed

+1550
-25
lines changed

5 files changed

+1550
-25
lines changed

.github/workflows/pages.yml

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,65 @@
1-
# Simple workflow for deploying static content to GitHub Pages
2-
name: Deploy static content to Pages
3-
1+
name: Deploy SvelteKit Site to GitHub Pages (with Deno)
42

53
on:
6-
# Runs on pushes targeting the default branch
74
push:
8-
branches: ["main"]
9-
10-
# Allows you to run this workflow manually from the Actions tab
11-
workflow_dispatch:
5+
branches: ["main"] # Trigger deployment on pushes to the main branch
6+
workflow_dispatch: # Allows manual triggering
127

138
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
149
permissions:
15-
contents: write
10+
contents: read
1611
pages: write
1712
id-token: write
1813

19-
# Allow one concurrent deployment
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.
2016
concurrency:
2117
group: "pages"
22-
cancel-in-progress: true
18+
cancel-in-progress: false
2319

2420
jobs:
25-
# Single deploy job since we're just deploying
26-
deploy:
27-
environment:
28-
name: github-pages
29-
url: ${{ steps.deployment.outputs.page_url }}
21+
build:
3022
runs-on: ubuntu-latest
3123
steps:
3224
- name: Checkout
33-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Deno
28+
uses: denoland/setup-deno@v2
29+
with:
30+
deno-version: v2.1.4
31+
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
35+
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
40+
env:
41+
VITE_BASE_PATH: /${{ github.event.repository.name }} # Set this to your repo name!
42+
43+
- name: Create .nojekyll file
44+
# Prevents GitHub Pages from running built files through Jekyll
45+
run: touch build/.nojekyll
46+
3447
- name: Setup Pages
35-
uses: actions/configure-pages@v1
36-
- name: Install and Build 🔧
37-
run: |
38-
npm ci
39-
npm run build
40-
- name: Deploy 🚀
41-
uses: JamesIves/github-pages-deploy-action@v4
48+
uses: actions/configure-pages@v5
49+
50+
- name of: Upload artifact
51+
uses: actions/upload-pages-artifact@v3
4252
with:
43-
folder: build # The folder the action should deploy.
53+
# Upload the 'build' directory (or whatever you set in svelte.config.js)
54+
path: './build'
4455

56+
deploy:
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
runs-on: ubuntu-latest
61+
needs: build # This job runs only after the 'build' job succeeds
62+
steps:
63+
- name: Deploy to GitHub Pages
64+
id: deployment
65+
uses: actions/deploy-pages@v4

deno.jsonc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json",
3+
"tasks": {
4+
// Task to install npm dependencies using Deno
5+
"install": "deno run -A npm:npm install",
6+
7+
// Task to run the SvelteKit development server
8+
"dev": "deno run -A npm:npm run dev -- --host",
9+
10+
// Task to build the project for production
11+
"build": "deno run -A npm:npm run build",
12+
13+
// Task to preview the production build locally
14+
"preview": "deno run -A npm:npm run preview -- --host"
15+
},
16+
"compilerOptions": {
17+
// Basic compiler options, you might adjust these as needed
18+
"allowJs": true,
19+
"lib": ["deno.window"],
20+
"strict": true
21+
},
22+
"fmt": {
23+
// Optional: Configure Deno's built-in formatter
24+
"options": {
25+
"useTabs": false,
26+
"lineWidth": 80,
27+
"indentWidth": 2,
28+
"singleQuote": true
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)