admin/.gitea/workflows/deploy-vps.yml
alisaza a8cd6fc252 ci: build admin on Finland, run on Iran, notify from Finland [skip ci]
Align with ops topology: act_runner/Telegram on Finland, runtime on Iran.
2026-09-13 18:34:21 +03:30

66 lines
2.3 KiB
YAML

name: Deploy admin to VPS
# Finland (git / act_runner): build image + Telegram notify
# Iran: runtime only (compose up pre-built image)
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: deploy-admin-production
cancel-in-progress: true
jobs:
deploy:
name: Build on Finland, run on Iran
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Deploy (Finland build → Iran runtime)
env:
FINLAND_SSH_KEY: ${{ secrets.FINLAND_SSH_KEY }}
FINLAND_HOST: ${{ secrets.FINLAND_HOST }}
FINLAND_USER: ${{ secrets.FINLAND_USER }}
IRAN_SSH_KEY: ${{ secrets.VPS_SSH_KEY }}
IRAN_HOST: ${{ secrets.VPS_HOST }}
IRAN_USER: ${{ secrets.VPS_USER }}
run: |
set -euo pipefail
test -n "${FINLAND_SSH_KEY:-}"
test -n "${FINLAND_HOST:-}"
test -n "${FINLAND_USER:-}"
test -n "${IRAN_SSH_KEY:-}"
test -n "${IRAN_HOST:-}"
test -n "${IRAN_USER:-}"
if ! command -v rsync >/dev/null 2>&1 || ! command -v ssh >/dev/null 2>&1; then
apt-get update -qq
apt-get install -y -qq rsync openssh-client
fi
chmod +x scripts/deploy-finland-to-iran.sh
IMAGE_TAG="ghabilee-admin:${GITHUB_SHA}" ./scripts/deploy-finland-to-iran.sh
- name: Notify Telegram
if: always()
continue-on-error: true
env:
DEPLOY_SHA: ${{ github.sha }}
DEPLOY_STATUS: ${{ job.status }}
DEPLOY_COMMIT_SUBJECT: ${{ github.event.head_commit.message }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_GROUP_CHAT_ID: ${{ secrets.TELEGRAM_GROUP_CHAT_ID }}
TELEGRAM_GROUP_THREAD_ID: ${{ secrets.TELEGRAM_GROUP_THREAD_ID }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
run: |
export DEPLOY_VERSION="$(node -p "require('./package.json').version" 2>/dev/null || echo '?')"
case "${DEPLOY_STATUS}" in
success) export DEPLOY_STATUS=success ;;
*) export DEPLOY_STATUS=failed ;;
esac
chmod +x scripts/notify-from-finland.sh scripts/notify-ops-telegram.sh scripts/notify-deploy.sh
./scripts/notify-from-finland.sh