added: workflow for github actions #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to VPS | |
uses: appleboy/ssh-action@v0.1.10 | |
with: | |
host: ${{ secrets.VPS_SSH_HOST }} | |
username: ${{ secrets.VPS_SSH_USERNAME }} | |
key: ${{ secrets.VPS_SSH_SECRET }} | |
passphrase: ${{ secrets.VPS_SSH_PASSPHRASE }} | |
port: ${{ secrets.VPS_SSH_PORT }} | |
script: | | |
eval "$(ssh-agent)" | |
ssh-add ~/.ssh/id_rsa | |
cd ${{ secrets.PROJECT_PATH }} | |
git pull origin main | |
docker-compose rm -sf | |
docker-compose build | |
docker-compose up -d | |
docker image prune -af |