diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..e8914d0 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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