Update .gitea/workflows/deploy.yaml
Remote Build and Deploy / deploy (push) Successful in 42s

This commit is contained in:
Simo committed 2026-07-11 23:11:36 +02:00
1 parent f9213beb9c
commit c768d80cab
1 file changed
+20 -39
+20 -39
View File
@@ -5,14 +5,9 @@ on:
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
@@ -22,55 +17,41 @@ jobs:
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"
# 1. Navigate to your project directory on the VPS
cd /var/www/atom-nexst/
cd "$APP_DIR"
test "$PWD" = "$APP_DIR"
# 2. Synchronize the application files via Git
git fetch origin
git reset --hard origin/main
# 2. Synchronize application files
echo "--- Synchronizing Git Repository ---"
git fetch origin main
git reset --hard FETCH_HEAD
# --- CLEAN-UP STEP ---
echo "--- Moving or removing specific items ---"
rm -rf /var/www/atom-nexst/directory-name
echo "--- Current Commit ---"
git rev-parse HEAD
# 3. Install dependencies from the lockfile
# Install missing node_modules based on updated package.json
echo "--- Installing Dependencies ---"
corepack enable
corepack prepare [email protected] --activate
pnpm install --frozen-lockfile --prod=false
pnpm install --frozen-lockfile
# Do not export .env manually.
# Next.js and the migration script load it themselves.
# Load environment variables from .env file for the next steps
export $(grep -v '^#' .env | xargs)
# 4. Generate Prisma client
echo "--- Generating Prisma Client ---"
pnpm prisma:generate
# 5. Run database migrations
# 3. Run database migrations natively
echo "--- Running Database Migrations ---"
pnpm db:migrate
# 6. Build the application
# Regenerate Prisma Client to update types
echo "--- Generating Prisma Client Types ---"
pnpm prisma generate
# 4. Compile the updated distribution assets
echo "--- Building Application ---"
rm -rf -- "$APP_DIR/.next"
pnpm build
# 7. Restart and verify service
# 5. Restart the host background service
echo "--- Restarting Atom Nexst Service ---"
systemctl restart atom-nexst.service
systemctl is-active --quiet atom-nexst.service
sudo systemctl restart atom-nexst.service
echo "--- Deployment Completed Successfully ---"