Aimpress_site/.github/workflows/deploy.yml
Vadym Samoilenko 1f1c7508b4 Deploy nginx.conf to server in CI/CD pipeline
server/nginx.conf was never synced to the server — CI/CD only deployed
dist/. Add rsync step to copy nginx.conf before container restart.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 22:08:39 +00:00

45 lines
1.3 KiB
YAML

name: Deploy to Server
on:
push:
branches: [main]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
env:
TINA_PUBLIC_CLIENT_ID: ${{ secrets.TINA_PUBLIC_CLIENT_ID }}
TINA_TOKEN: ${{ secrets.TINA_TOKEN }}
GITHUB_REF_NAME: ${{ github.ref_name }}
- name: Setup SSH
run: |
mkdir -p ~/.ssh
printf '%s\n' "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_deploy
chmod 600 ~/.ssh/id_deploy
ssh-keyscan -p 1220 57.128.160.249 >> ~/.ssh/known_hosts 2>/dev/null
- name: Deploy to server
run: |
rsync -avz --delete \
--exclude='blog/' \
-e "ssh -p 1220 -i ~/.ssh/id_deploy" \
dist/ ubuntu@57.128.160.249:/opt/00-infrastructure/Website/website/dist/
rsync -avz \
-e "ssh -p 1220 -i ~/.ssh/id_deploy" \
server/nginx.conf ubuntu@57.128.160.249:/opt/00-infrastructure/Website/website/nginx.conf
ssh -p 1220 -i ~/.ssh/id_deploy ubuntu@57.128.160.249 \
"cd /opt/00-infrastructure/Website/website && docker compose restart web"