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:
- main
concurrency:
group: atomcms-production-deploy
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
runs-on: shell
steps:
- name: Check out pushed commit
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Create release archive
- name: Deploy AtomCMS
shell: bash
run: |
set -Eeuo pipefail
git archive \
--format=tar.gz \
--output=atomcms-release.tar.gz \
"${GITHUB_SHA:-HEAD}"
- name: Upload release to VPS
uses: appleboy/[email protected]
with:
host: "172.20.2.1"
username: "root"
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
source: "atomcms-release.tar.gz"
target: "/tmp"
overwrite: true
readonly APP_DIR="/var/www/atom-nexst"
readonly SOURCE_DIR="${GITHUB_WORKSPACE}"
- name: Install and deploy on VPS
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
echo "--- Starting EPIC WEB CONTROL Deployment ---"
readonly APP_DIR="/var/www/atom-nexst"
readonly RELEASE="/tmp/atomcms-release.tar.gz"
test -n "$SOURCE_DIR"
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"
test -f "$APP_DIR/.env"
test -f "$RELEASE"
echo "--- Synchronizing Application Files ---"
cd "$APP_DIR"
test "$PWD" = "$APP_DIR"
sudo rsync -a --delete \
--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.
# Remove source directories so deleted files cannot remain on VPS.
rm -rf -- src public prisma scripts
echo "--- Preparing pnpm ---"
sudo corepack enable
sudo corepack prepare [email protected] --activate
tar -xzf "$RELEASE" -C "$APP_DIR"
rm -f -- "$RELEASE"
echo "--- Installing Locked Dependencies ---"
sudo pnpm install --frozen-lockfile --prod=false
echo "--- Preparing pnpm ---"
corepack enable
corepack prepare [email protected] --activate
echo "--- Generating Prisma Client ---"
sudo pnpm prisma:generate
echo "--- Installing Locked Dependencies ---"
pnpm install --frozen-lockfile --prod=false
echo "--- Running Database Migrations ---"
sudo pnpm db:migrate
echo "--- Generating Prisma Client ---"
pnpm prisma:generate
echo "--- Building Application ---"
sudo rm -rf -- "$APP_DIR/.next"
sudo pnpm build
echo "--- Running Database Migrations ---"
pnpm db:migrate
echo "--- Restarting Atom Nexst Service ---"
sudo systemctl restart atom-nexst.service
sudo systemctl is-active --quiet atom-nexst.service
echo "--- Building Application ---"
rm -rf -- .next
pnpm build
echo "--- Verifying Deployed Revision ---"
echo "DEPLOYED_COMMIT=${GITHUB_SHA}"
echo "--- Restarting Atom Nexst Service ---"
systemctl restart atom-nexst.service
systemctl is-active --quiet atom-nexst.service
echo "--- Deployment Completed Successfully ---"
echo "--- Deployment Completed Successfully ---"