feat: add action and static build
Some checks failed
Build and Deploy Svelte App / build-and-deploy (push) Failing after 3m41s

This commit is contained in:
itsscb 2025-04-09 23:27:49 +02:00
parent 30e4e40301
commit 9bca0f01d2
5 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,47 @@
name: Build and Deploy Svelte App
on:
push:
branches:
- main # Trigger the action on push to the main branch
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# Check out the repository
- name: Checkout Repository
uses: actions/checkout@v2
# Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '23' # You can adjust the Node.js version if needed
# Install dependencies
- name: Install Dependencies
run: |
npm install
# Build the Svelte app
- name: Build the Svelte app
run: |
npm run build
# Deploy the build to your server (e.g., using SCP, Rsync, or FTP)
- name: Deploy to Strato.de (SFTP example)
run: |
sudo apt-get install -y sshpass # Install sshpass for non-interactive SSH authentication
sshpass -p "$DEPLOY_PASSWORD" scp -r build/* "$DEPLOY_USER@$DEPLOY_SERVER:/"
env:
DEPLOY_PASSWORD: ${{ secrets.STRATO_PASSWORD }} # Add your deployment password to secrets
DEPLOY_USER: ${{ secrets.STRATO_USER }} # Add your deploy username to secrets
DEPLOY_SERVER: ${{ secrets.STRATO_SERVER }} # Add your deploy server address to secrets
# Clean up if necessary (optional step)
- name: Clean up
run: |
rm -rf build/

11
package-lock.json generated
View File

@ -9,6 +9,7 @@
"version": "0.0.1",
"devDependencies": {
"@sveltejs/adapter-auto": "^4.0.0",
"@sveltejs/adapter-static": "^3.0.8",
"@sveltejs/kit": "^2.16.0",
"@sveltejs/vite-plugin-svelte": "^5.0.0",
"svelte": "^5.0.0",
@ -819,6 +820,16 @@
"@sveltejs/kit": "^2.0.0"
}
},
"node_modules/@sveltejs/adapter-static": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-3.0.8.tgz",
"integrity": "sha512-YaDrquRpZwfcXbnlDsSrBQNCChVOT9MGuSg+dMAyfsAa1SmiAhrA5jUYUiIMC59G92kIbY/AaQOWcBdq+lh+zg==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"@sveltejs/kit": "^2.0.0"
}
},
"node_modules/@sveltejs/kit": {
"version": "2.20.5",
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.20.5.tgz",

View File

@ -12,6 +12,7 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.8",
"@sveltejs/adapter-auto": "^4.0.0",
"@sveltejs/kit": "^2.16.0",
"@sveltejs/vite-plugin-svelte": "^5.0.0",

1
src/routes/+page.js Normal file
View File

@ -0,0 +1 @@
export const prerender = true;

View File

@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */