Files
EpicNext-Cms/.gitea/workflows/deploy.yaml
T
Simo f9213beb9c
Remote Build and Deploy / deploy (push) Failing after 8s
Update .gitea/workflows/deploy.yaml
2026-07-11 23:09:57 +02:00

76 lines
2.1 KiB
YAML

name: Remote Build and Deploy
on:
push:
branches:
- main
concurrency:
group: atomcms-production-deploy
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Deploying via SSH connection to VPS Host
uses: appleboy/[email protected]
with:
host: "172.20.2.1"
username: "root"
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
timeout: 120s
command_timeout: 25m
script: |
set -Eeuo pipefail
readonly APP_DIR="/var/www/atom-nexst"
echo "--- Starting EPIC WEB CONTROL Deployment ---"
# 1. Navigate safely to the project directory
test -d "$APP_DIR"
test -f "$APP_DIR/.env"
cd "$APP_DIR"
test "$PWD" = "$APP_DIR"
# 2. Synchronize application files
echo "--- Synchronizing Git Repository ---"
git fetch origin main
git reset --hard FETCH_HEAD
echo "--- Current Commit ---"
git rev-parse HEAD
# 3. Install dependencies from the lockfile
echo "--- Installing Dependencies ---"
corepack enable
corepack prepare [email protected] --activate
pnpm install --frozen-lockfile --prod=false
# Do not export .env manually.
# Next.js and the migration script load it themselves.
# 4. Generate Prisma client
echo "--- Generating Prisma Client ---"
pnpm prisma:generate
# 5. Run database migrations
echo "--- Running Database Migrations ---"
pnpm db:migrate
# 6. Build the application
echo "--- Building Application ---"
rm -rf -- "$APP_DIR/.next"
pnpm build
# 7. Restart and verify service
echo "--- Restarting Atom Nexst Service ---"
systemctl restart atom-nexst.service
systemctl is-active --quiet atom-nexst.service
echo "--- Deployment Completed Successfully ---"