Files
EpicNext-Cms/.gitea/workflows/deploy.yaml
T
remco 149dc215f0
Local Build and Deploy / deploy (push) Failing after 19s
Update .gitea/workflows/deploy.yaml
2026-07-12 14:20:07 +02:00

61 lines
2.1 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/
# Prevent Git permission errors from the previous www-data ownership change
git config --global --add safe.directory /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
# REMOVE OLD CACHE AND BUILDS
rm -rf .next .output dist
# 4. Configure trusted dependencies and install packages smoothly
export PNPM_CONFIG_ONLY_BUILT_DEPENDENCIES="@parcel/watcher,@swc/core,sharp"
pnpm install
# 5. Sync Prisma with the actual DB structure and generate types
echo "Syncing schema with database..."
pnpm prisma db pull
pnpm prisma generate
# 6. Next.js Build
pnpm build
# 7. Fix ownership: Build first, THEN set permissions for the web server
sudo chown -R www-data:www-data /var/www/atom-nexst/
# 8. Hard restart of the Systemd service to clear memory cache
echo "Hard resetting systemd service..."
sudo systemctl stop atom-nexst.service
sudo systemctl start atom-nexst.service
# Extra health check: Ensure the service is actually running
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 ---"