Fix Gitea deploy: restore VPS shell workflow without GitHub Actions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
smhk1376andCursor committed 2026-10-20 01:20:36 +03:30
1 parent e1b5286946
commit 29b71c228e
2 files changed
+48 -14

No files matched your search

+21 -14
View File
@@ -13,20 +13,27 @@ jobs:
deploy:
runs-on: local-host
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
- name: Build Next.js standalone (host; npm cache reused between runs)
- name: Build and deploy on the VPS
env:
NEXT_PUBLIC_SITE_URL: https://edu.mstaut.ir
run: bash scripts/ci-build-prebuilt.sh
- name: Roll out (runtime image, backup, migrate, smoke, swap)
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_ACTOR: ${{ github.actor }}
REPO_NAME: ${{ github.repository }}
DEPLOY_SHA: ${{ github.sha }}
run: |
set -euo pipefail
rm -rf prebuilt/static
PREBUILT_DIR="$GITHUB_WORKSPACE/prebuilt" bash scripts/deploy-production.sh
TARGET=/opt/prod/Aut.ManagementFaculty
mkdir -p "$TARGET"
if [ ! -d "$TARGET/.git" ]; then
git -C "$TARGET" init
git -C "$TARGET" remote add origin "http://127.0.0.1:8301/$REPO_NAME.git"
fi
rm -f \
"$TARGET/.git/shallow.lock" \
"$TARGET/.git/index.lock" \
"$TARGET/.git/HEAD.lock" \
"$TARGET/.git/config.lock"
AUTH=$(printf '%s:%s' "$REPO_ACTOR" "$REPO_TOKEN" | base64 -w0)
git -C "$TARGET" -c "http.extraHeader=Authorization: Basic $AUTH" fetch --depth=1 origin "$DEPLOY_SHA"
unset AUTH REPO_TOKEN
git -C "$TARGET" checkout --detach --force FETCH_HEAD
bash "$TARGET/scripts/vps-autodeploy.sh"