feat: add local staging deploy workflow
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
This commit is contained in:
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
# Helyi, kézi staging kiadás: unit teszt -> push -> szerveroldali deploy -> staging smoke teszt.
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
readonly STAGE_HOST="${STAGE_HOST:-sadmin@llmdev.mozdit.hu}"
|
||||
readonly STAGE_PATH="${STAGE_PATH:-/home/sadmin/websitedev}"
|
||||
readonly STAGE_URL="${STAGE_URL:-https://stage.mozdit.hu}"
|
||||
readonly DEPLOY_BRANCH="${DEPLOY_BRANCH:-main}"
|
||||
readonly PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
readonly APP_ROOT="${PROJECT_ROOT}/proto"
|
||||
|
||||
fail() {
|
||||
printf 'HIBA: %s\n' "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
require_command() {
|
||||
command -v "$1" >/dev/null 2>&1 || fail "Hiányzó parancs: $1"
|
||||
}
|
||||
|
||||
ensure_clean_worktree() {
|
||||
[[ -z "$(git status --porcelain)" ]] || fail "A munkakönyvtár nem tiszta. Commitold vagy tedd félre a változásokat a staging kiadás előtt."
|
||||
}
|
||||
|
||||
require_command git
|
||||
require_command npm
|
||||
require_command ssh
|
||||
|
||||
cd "${PROJECT_ROOT}"
|
||||
[[ "$(git branch --show-current)" == "${DEPLOY_BRANCH}" ]] || fail "A kiadás csak a ${DEPLOY_BRANCH} ágról engedélyezett."
|
||||
ensure_clean_worktree
|
||||
|
||||
printf '1/4 Függőségek és unit tesztek…\n'
|
||||
(
|
||||
cd "${APP_ROOT}"
|
||||
npm ci
|
||||
npm run test:unit
|
||||
)
|
||||
|
||||
# A tesztek nem módosíthatják a kiadandó commitot.
|
||||
ensure_clean_worktree
|
||||
|
||||
printf '2/4 Commit feltolása a Gitea-ra…\n'
|
||||
git push origin "${DEPLOY_BRANCH}"
|
||||
|
||||
printf '3/4 Staging deploy (%s:%s)…\n' "${STAGE_HOST}" "${STAGE_PATH}"
|
||||
ssh -o BatchMode=yes -o ConnectTimeout=15 "${STAGE_HOST}" \
|
||||
"cd '${STAGE_PATH}' && git pull --ff-only origin '${DEPLOY_BRANCH}' && ./deploy.sh staging"
|
||||
|
||||
printf '4/4 Staging smoke teszt (%s)…\n' "${STAGE_URL}"
|
||||
(
|
||||
cd "${APP_ROOT}"
|
||||
BASE_URL="${STAGE_URL}" npm run test:smoke:staging
|
||||
)
|
||||
|
||||
printf '\nSikeres staging kiadás: %s\n' "$(git rev-parse --short HEAD)"
|
||||
Reference in New Issue
Block a user