899c54e1fc
Auth: drop localStorage session token entirely, talk to netrunner-backend via credentials:"include" HttpOnly cookies shared over the common parent domain, and redirect to the account subdomain (ЛК) after login instead of a dead local /profile route. Config: NEXT_PUBLIC_* values used by client components (API_URL, ACCOUNT_ORIGIN, BOT_USERNAME, PB_URL) get inlined into the JS bundle at image build time and can't be overridden by docker-compose environment at container start. Moved these reads into server components (page.tsx) and thread them down as props, so one built image can genuinely serve both prod and dev by config alone. CI/CD: split the old single auto-deploy-to-prod workflow into build.yml (build+push on every push to main) and deploy.yml with deploy-dev (auto, same VPS as netrunner-backend's dev environment) and deploy-prod (manual dispatch only) — mirrors netrunner-backend's pipeline shape. Added docker-compose.dev-remote.yml pointing at the dev backend. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
94 lines
3.1 KiB
YAML
94 lines
3.1 KiB
YAML
name: Deploy
|
||
|
||
# Один пайплайн, две джобы (по аналогии с netrunner-backend):
|
||
# - deploy-dev: авто, срабатывает после успешного "Build & Push Image" на main.
|
||
# - deploy-prod: вручную из вкладки Actions ("Run workflow").
|
||
on:
|
||
workflow_run:
|
||
workflows: ["Build & Push Image"]
|
||
types: [completed]
|
||
branches: [main]
|
||
workflow_dispatch:
|
||
|
||
jobs:
|
||
deploy-dev:
|
||
name: Auto-deploy to Dev VPS
|
||
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
with:
|
||
ref: ${{ github.event.workflow_run.head_sha }}
|
||
|
||
# Копируем только compose-файл — сам образ дев-сервер тянет из GHCR.
|
||
- name: Sync compose file to Dev VPS
|
||
uses: appleboy/scp-action@v0.1.7
|
||
with:
|
||
host: ${{ secrets.DEV_VPS_IP }}
|
||
username: root
|
||
key: ${{ secrets.DEV_SSH_PRIVATE_KEY }}
|
||
source: "docker-compose.dev-remote.yml"
|
||
target: "/root/netrunner-frontend-dev"
|
||
strip_components: 0
|
||
|
||
- name: Remote deploy via SSH
|
||
uses: appleboy/ssh-action@v1
|
||
with:
|
||
host: ${{ secrets.DEV_VPS_IP }}
|
||
username: root
|
||
key: ${{ secrets.DEV_SSH_PRIVATE_KEY }}
|
||
script: |
|
||
set -e
|
||
cd /root/netrunner-frontend-dev
|
||
|
||
echo "🚀 Deploying landing+proxy:latest to DEV"
|
||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
||
|
||
docker compose -f docker-compose.dev-remote.yml pull
|
||
docker compose -f docker-compose.dev-remote.yml up -d --remove-orphans
|
||
|
||
docker image prune -f
|
||
|
||
echo "✅ Dev synchronized."
|
||
|
||
deploy-prod:
|
||
name: Pull & restart on Prod VPS
|
||
if: github.event_name == 'workflow_dispatch'
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout Code
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Copy docker-compose.yml to VPS
|
||
uses: appleboy/scp-action@v0.1.7
|
||
with:
|
||
host: ${{ secrets.VPS_IP }}
|
||
username: root
|
||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||
source: "docker-compose.yml"
|
||
target: "/root/netrunner-frontend"
|
||
|
||
- name: Deploy via SSH
|
||
uses: appleboy/ssh-action@v1.0.3
|
||
with:
|
||
host: ${{ secrets.VPS_IP }}
|
||
username: root
|
||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||
script: |
|
||
set -e
|
||
cd /root/netrunner-frontend
|
||
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||
|
||
echo "🚀 Deploying landing+proxy:latest to PROD"
|
||
|
||
# Тянем оба образа
|
||
docker compose pull
|
||
|
||
# Поднимаем всё
|
||
docker compose up -d --force-recreate --remove-orphans
|
||
|
||
# Чистим старье
|
||
docker image prune -f
|
||
|
||
echo "✅ Uplink synchronized."
|