add github workflow

This commit is contained in:
vchikalkin 2024-12-21 18:06:58 +03:00
parent a34521973f
commit 79dcf49d5a

30
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Deploy to VPS
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up SSH
uses: webfactory/ssh-agent@v0.8.1
with:
ssh-private-key: ${{ secrets.VPS_SSH_KEY }}
- name: Deploy via SSH
env:
USER: ${{ secrets.VPS_USER }}
HOST: ${{ secrets.VPS_HOST }}
run: |
ssh -o StrictHostKeyChecking=no $USER@$HOST << 'EOF'
cd ~/portfolio/
git pull origin main
docker compose up --build -d
EOF