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