Files
netrunner-landing/.github/workflows/deploy.yml
T
2026-05-03 16:59:59 +07:00

85 lines
2.3 KiB
YAML

name: Deploy Netrunner App
on:
push:
branches: [main]
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
lfs: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Сборка Лендинга (Next.js)
- name: Build and Push Landing
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/nineap/netrunner-landing:latest
cache-from: type=gha
cache-to: type=gha,mode=max
# Сборка Прокси (Rust) - указываем контекст папки proxy-ws
- name: Build and Push Proxy
uses: docker/build-push-action@v5
with:
context: ./proxy-ws
file: ./proxy-ws/Dockerfile
push: true
tags: ghcr.io/nineap/netrunner-landing-proxy:latest
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
needs: build-and-push
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: |
cd /root/netrunner-frontend
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# Тянем оба новых образа
docker compose pull
# Поднимаем всё
docker compose up -d --force-recreate --remove-orphans
# Чистим старье
docker image prune -f