Justin Deal 647d98e6b6
All checks were successful
Build and Deploy / build (push) Successful in 39s
Update CICD steps
2025-05-03 16:08:39 -07:00

47 lines
1.3 KiB
YAML

name: Build and Deploy
on:
# Trigger the workflow every time you push to the `main` branch
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab on Gitea.
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y rsync build-essential libvips-dev
pnpm install
- name: Build Site
run: pnpm run build
- name: Verify build
run: |
if [ ! -d "./dist" ]; then
echo "❌ Build failed: dist directory not found"
exit 1
fi
- name: Deploy to server
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SERVER_IP: ${{ secrets.SERVER_IP }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H $SERVER_IP >> ~/.ssh/known_hosts
rsync -avzP -e "ssh -i ~/.ssh/id_rsa" ./dist/ root@$SERVER_IP:/var/www/html/
echo "🚀 Deployment completed successfully!"