53 lines
1.6 KiB
YAML
53 lines
1.6 KiB
YAML
name: Remote Build and Deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# 1. Debugging stap: Deze stap onthult direct of de secret door Gitea wordt doorgegeven.
|
|
- name: Debug Secret
|
|
run: |
|
|
if [ -z "${{ secrets.VPS_HOST }}" ]; then
|
|
echo "FOUT: VPS_HOST secret is leeg of niet beschikbaar!"
|
|
exit 1
|
|
else
|
|
echo "VPS_HOST is succesvol geladen."
|
|
fi
|
|
|
|
# 2. De Deployment stap
|
|
- name: Deploying via SSH connection to VPS Host
|
|
uses: appleboy/[email protected]
|
|
with:
|
|
host: ${{ secrets.VPS_HOST }}
|
|
username: "root"
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
port: 22
|
|
script: |
|
|
set -e
|
|
echo "--- Starting EPIC WEB CONTROL Deployment ---"
|
|
|
|
cd /var/www/atom-nexst/
|
|
|
|
# Update de code
|
|
git fetch origin --prune
|
|
git reset --hard origin/main
|
|
|
|
# Cleanup
|
|
if [ -d "directory-name" ]; then rm -rf directory-name; fi
|
|
|
|
# Installeer en bouw
|
|
# Gebruik het volledige pad voor pnpm (controleer dit met 'which pnpm' op je server)
|
|
/usr/local/bin/pnpm install --frozen-lockfile
|
|
/usr/local/bin/pnpm db:migrate
|
|
/usr/local/bin/pnpm prisma generate
|
|
/usr/local/bin/pnpm build
|
|
|
|
# Restart
|
|
sudo systemctl restart atom-nexst.service
|
|
|
|
echo "--- EPIC WEB CONTROL Deployment Completed Successfully ---"
|
|
|