Skip to content

xig: deploy

xig: deploy #48

Workflow file for this run

name: Deploy to Server
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add server to known_hosts
run: ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
- name: Deploy to server
run: |
ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} << 'ENDSSH'
cd ${{ secrets.SERVER_DEPLOY_PATH }}
git pull origin main
docker stop ${{ secrets.APP_NAME }} || true
docker rm ${{ secrets.APP_NAME }} || true
docker system prune -f
docker build -t ${{ secrets.APP_NAME }} .
ENDSSH