Aimpress_site/.github/workflows/deploy.yml
Vadym Samoilenko 5fa337d97a Preserve server blog content: exclude blog/ from rsync --delete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 22:14:39 +00:00

41 lines
1.2 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/
ssh -p 1220 -i ~/.ssh/id_deploy ubuntu@57.128.160.249 \
"cd /opt/00-infrastructure/Website/website && docker compose restart web"