mirror of
https://github.com/complexcaresolutions/frontend.blogwoman.de.git
synced 2026-03-17 15:04:01 +00:00
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:
parent
7b486292a0
commit
8f80eca72a
1 changed files with 40 additions and 0 deletions
40
.github/workflows/deploy-staging.yml
vendored
Normal file
40
.github/workflows/deploy-staging.yml
vendored
Normal 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 ==="
|
||||
Loading…
Reference in a new issue