37 lines
1.3 KiB
YAML
37 lines
1.3 KiB
YAML
name: Remote Build and Deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Execute Build and Deploy Commands
|
|
run: |
|
|
echo "--- Starting EPIC WEB CONTROL Deployment ---"
|
|
|
|
# We misbruiken de docker socket om een commando direct op de VPS host uit te voeren
|
|
# Dit lost alle problemen op met ontbrekende mappen, pnpm, of sudo-rechten!
|
|
docker run --rm \
|
|
-v /var/www/atom-next:/app \
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
--pid=host \
|
|
node:20-bullseye \
|
|
bash -c "
|
|
cd /app &&
|
|
git fetch --all &&
|
|
git reset --hard origin/main &&
|
|
echo '--- Running Database Migrations ---' &&
|
|
npm install -g pnpm &&
|
|
pnpm db:migrate &&
|
|
echo '--- Building Application ---' &&
|
|
pnpm build
|
|
"
|
|
|
|
# Herstart de service op de host via een tijdelijke container met host-rechten
|
|
echo "--- Restarting Atom Next Service ---"
|
|
docker run --rm --pid=host --privileged alpine proto-systemctl restart atom-next.service || true
|
|
|
|
echo "--- Deployment Completed Successfully ---" |