55 lines
1.9 KiB
YAML
55 lines
1.9 KiB
YAML
name: Local Build and Deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
jobs:
|
|
deploy:
|
|
runs-on: shell
|
|
steps:
|
|
- name: Run Deploy Scripts Locally
|
|
run: |
|
|
set -e
|
|
echo "--- EPIC WEB CONTROL: Starting Auto-Cleanup & Deploy ---"
|
|
|
|
# 1. Clean up unused build images safely
|
|
docker image prune -f
|
|
|
|
# 2. Navigate to your website directory
|
|
cd /var/www/atom-nexst/
|
|
|
|
# Point Git directly to the local Gitea folder path
|
|
git remote set-url origin /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git/
|
|
|
|
# 3. Fetch and update code
|
|
git fetch origin --prune
|
|
git reset --hard origin/main
|
|
|
|
# VERWIJDER OUDE CACHE EN BUILDS (Pas aan naar .output, .next of dist afhankelijk van je framework)
|
|
rm -rf .next .output dist
|
|
|
|
# 4. Configure pnpm to automatically approve build scripts
|
|
pnpm config set trusted-dependencies @parcel/watcher,@swc/core,sharp
|
|
|
|
# Install dependencies, run migrations, and build the application
|
|
pnpm install --frozen-lockfile
|
|
pnpm db:migrate
|
|
pnpm prisma generate
|
|
pnpm build
|
|
|
|
# 5. Fix ownership: Eerst bouwen onder de runner, DAARNA pas naar de webserver zetten
|
|
sudo chown -R www-data:www-data /var/www/atom-nexst/
|
|
|
|
# 6. Harde herstart van de Systemd service
|
|
echo "Hard resetting systemd service..."
|
|
sudo systemctl stop atom-nexst.service
|
|
sudo systemctl start atom-nexst.service
|
|
|
|
# Extra check: Staat hij echt aan?
|
|
sleep 2
|
|
if ! systemctl is-active --quiet atom-nexst.service; then
|
|
echo "ERROR: atom-nexst.service failed to start!" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "--- Deployment successfully completed ---" |