wesal/.github/workflows/deploy-prod.yml

33 lines
762 B
YAML

name: Deploy to Production
on:
push:
branches:
- main
- master
jobs:
deploy:
name: Deploy to Production
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
environment: Production
steps:
- name: Deploy to Server
uses: appleboy/ssh-action@v0.1.5
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: |
whoami
cd /home/wesal
git pull origin main
docker compose down
docker compose up -d --build
docker image prune -f