Some checks failed
Build and Deploy Svelte App / build-and-deploy (push) Failing after 1m1s
49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
|
|
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 update # Update package list
|
|
sudo apt-get install -y sshpass # Install sshpass
|
|
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/
|