Update .gitea/workflows/deploy.yaml
Remote Build and Deploy / deploy (push) Failing after 2s

Signed-off-by: Simo <[email protected]>
This commit is contained in:
Simo committed 2026-07-11 23:05:14 +02:00
1 parent c57a894d7a
commit f48532f2d0
1 file changed
+48 -57
+48 -57
View File
@@ -5,84 +5,75 @@ on:
branches: branches:
- main - main
concurrency:
group: atomcms-production-deploy
cancel-in-progress: false
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: shell
steps: steps:
- name: Check out pushed commit - name: Check out pushed commit
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Create release archive - name: Deploy AtomCMS
shell: bash
run: | run: |
set -Eeuo pipefail set -Eeuo pipefail
git archive \
--format=tar.gz \
--output=atomcms-release.tar.gz \
"${GITHUB_SHA:-HEAD}"
- name: Upload release to VPS readonly APP_DIR="/var/www/atom-nexst"
uses: appleboy/[email protected] readonly SOURCE_DIR="${GITHUB_WORKSPACE}"
with:
host: "172.20.2.1"
username: "root"
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
source: "atomcms-release.tar.gz"
target: "/tmp"
overwrite: true
- name: Install and deploy on VPS echo "--- Starting EPIC WEB CONTROL Deployment ---"
uses: appleboy/[email protected]
with:
host: "172.20.2.1"
username: "root"
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
command_timeout: 20m
script: |
set -Eeuo pipefail
readonly APP_DIR="/var/www/atom-nexst" test -n "$SOURCE_DIR"
readonly RELEASE="/tmp/atomcms-release.tar.gz" test -d "$SOURCE_DIR/src"
test -f "$SOURCE_DIR/package.json"
test -f "$SOURCE_DIR/pnpm-lock.yaml"
echo "--- Starting EPIC WEB CONTROL Deployment ---" test -d "$APP_DIR"
test -f "$APP_DIR/.env"
test "$APP_DIR" = "/var/www/atom-nexst"
test -d "$APP_DIR" echo "--- Synchronizing Application Files ---"
test -f "$APP_DIR/.env"
test -f "$RELEASE"
cd "$APP_DIR" sudo rsync -a --delete \
test "$PWD" = "$APP_DIR" --exclude=".git/" \
--exclude=".env" \
--exclude=".next/" \
--exclude="node_modules/" \
--exclude="storage/" \
--exclude="docs/" \
"$SOURCE_DIR/" "$APP_DIR/"
echo "--- Updating Application Files ---" cd "$APP_DIR"
test "$PWD" = "$APP_DIR"
# Preserve .env, storage and node_modules. echo "--- Preparing pnpm ---"
# Remove source directories so deleted files cannot remain on VPS. sudo corepack enable
rm -rf -- src public prisma scripts sudo corepack prepare [email protected] --activate
tar -xzf "$RELEASE" -C "$APP_DIR" echo "--- Installing Locked Dependencies ---"
rm -f -- "$RELEASE" sudo pnpm install --frozen-lockfile --prod=false
echo "--- Preparing pnpm ---" echo "--- Generating Prisma Client ---"
corepack enable sudo pnpm prisma:generate
corepack prepare [email protected] --activate
echo "--- Installing Locked Dependencies ---" echo "--- Running Database Migrations ---"
pnpm install --frozen-lockfile --prod=false sudo pnpm db:migrate
echo "--- Generating Prisma Client ---" echo "--- Building Application ---"
pnpm prisma:generate sudo rm -rf -- "$APP_DIR/.next"
sudo pnpm build
echo "--- Running Database Migrations ---" echo "--- Restarting Atom Nexst Service ---"
pnpm db:migrate sudo systemctl restart atom-nexst.service
sudo systemctl is-active --quiet atom-nexst.service
echo "--- Building Application ---" echo "--- Verifying Deployed Revision ---"
rm -rf -- .next echo "DEPLOYED_COMMIT=${GITHUB_SHA}"
pnpm build
echo "--- Restarting Atom Nexst Service ---" echo "--- Deployment Completed Successfully ---"
systemctl restart atom-nexst.service
systemctl is-active --quiet atom-nexst.service
echo "--- Deployment Completed Successfully ---"