Compare commits

...
2 Commits
Author SHA1 Message Date
smhk1376 fe3d153ef1 Add local database dump directory to .gitignore to prevent accidental commits of backups.
Deploy edu.mstaut.ir / deploy (push) Failing after 34s
2026-10-20 01:21:16 +03:30
smhk1376andCursor 29b71c228e Fix Gitea deploy: restore VPS shell workflow without GitHub Actions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-20 01:20:36 +03:30
3 changed files with 51 additions and 14 deletions

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"
+3
View File
@@ -37,6 +37,9 @@ yarn-error.log*
# env files (can opt-in for committing if needed)
.env*
# local database dumps — never commit
/backups/
# vercel
.vercel
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Run on the VPS after the repo is checked out (Gitea local-host runner).
# No GitHub Actions dependencies — only git, Docker, and bash.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
export DISABLE_REACT_COMPILER=1
export NEXT_TELEMETRY_DISABLED=1
export NEXT_PUBLIC_SITE_URL="${NEXT_PUBLIC_SITE_URL:-https://edu.mstaut.ir}"
export NODE_OPTIONS="${NODE_OPTIONS:---max-old-space-size=3072}"
echo "Building Next.js at $ROOT (Node 22 container)…"
DOCKER_BUILDKIT=1 docker run --rm \
-e DISABLE_REACT_COMPILER=1 \
-e NEXT_TELEMETRY_DISABLED=1 \
-e NEXT_PUBLIC_SITE_URL \
-e NODE_OPTIONS \
-v "$ROOT:/app" -w /app \
--mount type=cache,target=/root/.npm \
node:22-alpine \
sh -ec 'npm ci --no-audit --no-fund && npm run build'
bash scripts/assemble-prebuilt.sh "$ROOT/prebuilt"
rm -rf "$ROOT/prebuilt/static"
PREBUILT_DIR="$ROOT/prebuilt" bash scripts/deploy-production.sh