Compare commits
2
Commits
e1b5286946
...
fe3d153ef1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe3d153ef1 | ||
|
|
29b71c228e |
No files matched your search
+21
-14
@@ -13,20 +13,27 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: local-host
|
runs-on: local-host
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Build and deploy on the VPS
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "22"
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Build Next.js standalone (host; npm cache reused between runs)
|
|
||||||
env:
|
env:
|
||||||
NEXT_PUBLIC_SITE_URL: https://edu.mstaut.ir
|
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: bash scripts/ci-build-prebuilt.sh
|
REPO_ACTOR: ${{ github.actor }}
|
||||||
|
REPO_NAME: ${{ github.repository }}
|
||||||
- name: Roll out (runtime image, backup, migrate, smoke, swap)
|
DEPLOY_SHA: ${{ github.sha }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
rm -rf prebuilt/static
|
TARGET=/opt/prod/Aut.ManagementFaculty
|
||||||
PREBUILT_DIR="$GITHUB_WORKSPACE/prebuilt" bash scripts/deploy-production.sh
|
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"
|
||||||
@@ -37,6 +37,9 @@ yarn-error.log*
|
|||||||
# env files (can opt-in for committing if needed)
|
# env files (can opt-in for committing if needed)
|
||||||
.env*
|
.env*
|
||||||
|
|
||||||
|
# local database dumps — never commit
|
||||||
|
/backups/
|
||||||
|
|
||||||
# vercel
|
# vercel
|
||||||
.vercel
|
.vercel
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in new issue
Block a user