🚀 Makes deploy action run

This commit is contained in:
Rune Harlyk
2025-07-10 22:34:24 +02:00
parent a3de13c619
commit 743aa073b7
4 changed files with 52 additions and 37 deletions
+17 -8
View File
@@ -3,6 +3,12 @@ name: Deploy GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
@@ -14,39 +20,42 @@ jobs:
defaults:
run:
working-directory: ./app
env:
BASE_PATH: /SpotMicroESP32-Leika
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 9
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache: "pnpm"
cache-dependency-path: "./app/pnpm-lock.yaml"
- run: pnpm install
- run: pnpm run build
- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4
with:
static_site_generator: "sveltekit"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: build/
path: app/build/
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@v2
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4
+13 -13
View File
@@ -1,22 +1,22 @@
export const prerender = false;
export const ssr = false;
export const prerender = true
export const ssr = false
const registerFetchIntercept = async () => {
const { fetch: originalFetch } = window;
const fileService = (await import('$lib/services/file-service')).default;
const { fetch: originalFetch } = window
const fileService = (await import('$lib/services/file-service')).default
window.fetch = async (resource, config) => {
let url = resource instanceof Request ? resource.url : resource.toString();
let file = await fileService?.getFile(url);
return file?.isOk() ? new Response(file.inner) : originalFetch(resource, config);
};
};
const url = resource instanceof Request ? resource.url : resource.toString()
const file = await fileService?.getFile(url)
return file?.isOk() ? new Response(file.inner) : originalFetch(resource, config)
}
}
export const load = async () => {
await registerFetchIntercept();
await registerFetchIntercept()
return {
title: 'Spot micro controller',
github: 'runeharlyk/SpotMicroESP32-Leika',
app_name: 'Spot Micro Controller',
copyright: '2025 Rune Harlyk',
};
};
copyright: '2025 Rune Harlyk'
}
}
+6 -3
View File
@@ -1,10 +1,10 @@
import adapter from '@sveltejs/adapter-static'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
const basePath = process.env.BASE_PATH ?? ''
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
@@ -14,7 +14,10 @@ const config = {
fallback: 'index.html',
precompress: false,
strict: true
})
}),
paths: {
base: basePath
}
}
}
+16 -13
View File
@@ -1,27 +1,30 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import Icons from 'unplugin-icons/vite';
import viteLittleFS from './vite-plugin-littlefs';
import EnvCaster from '@niku/vite-env-caster';
import tailwindcss from '@tailwindcss/vite';
import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'
import Icons from 'unplugin-icons/vite'
import viteLittleFS from './vite-plugin-littlefs'
import EnvCaster from '@niku/vite-env-caster'
import tailwindcss from '@tailwindcss/vite'
const basePath = process.env.BASE_PATH ?? ''
export default defineConfig({
base: basePath,
plugins: [
tailwindcss(),
sveltekit(),
Icons({
compiler: 'svelte',
compiler: 'svelte'
}),
viteLittleFS(),
EnvCaster(),
EnvCaster()
],
server: {
proxy: {
'/api': {
target: 'http://spot-micro.local/',
changeOrigin: true,
ws: true,
},
},
},
});
ws: true
}
}
}
})