ci: add staging deploy workflow via SSH

Deploys to sv-frontend on push to develop.
Uses port-forwarding through UDM Pro SE (37.24.237.181:2204).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
CCS Admin 2026-02-15 22:24:40 +00:00
parent 7b486292a0
commit 8f80eca72a

40
.github/workflows/deploy-staging.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: Deploy to Staging
on:
push:
branches: [develop]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/develop'
steps:
- name: Deploy via SSH
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.SSH_HOST }}
port: ${{ secrets.SSH_PORT }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script_stop: true
script: |
REPO="${{ github.event.repository.name }}"
DIR="$HOME/${REPO}"
echo "=== Deploying ${REPO} to staging ==="
cd "${DIR}" || { echo "Directory ${DIR} not found"; exit 1; }
echo "--- Git pull ---"
git pull origin develop
echo "--- Install dependencies ---"
pnpm install --frozen-lockfile
echo "--- Build ---"
pnpm build
echo "--- Restart PM2 (if running) ---"
pm2 describe "${REPO}" > /dev/null 2>&1 && pm2 restart "${REPO}" || echo "No PM2 process for ${REPO}"
echo "=== Deploy complete ==="