Skip to content

Commit

Permalink
add CICD (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
106303551 authored Jul 11, 2024
1 parent 5b3c9dd commit 19f825b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/deploy_backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy to Server

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
environment: deployTest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.POLYHISTOR_PRIVATE_KEY }}

- name: Deploy to server
env:
SSH_HOST: ${{ secrets.POLYHISTOR_SSH_HOST }}
SSH_USER: ${{ secrets.POLYHISTOR_SSH_USER }}
SSH_PORT: ${{ secrets.POLYHISTOR_SSH_PORT }}
run: |
ssh -o StrictHostKeyChecking=no -p $SSH_PORT $SSH_USER@$SSH_HOST << 'EOF'
cd polyhistor
git pull origin main
chmod +x deploy.sh
./deploy.sh
EOF
3 changes: 3 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sudo docker stop polyhistor_backend_1
echo y | sudo docker system prune
sudo docker-compose up --force-recreate -d --build backend

0 comments on commit 19f825b

Please sign in to comment.