Skip to content

Commit

Permalink
ci: added GitHub Workflow to automatically deploy backend
Browse files Browse the repository at this point in the history
  • Loading branch information
MAXOUXAX committed Jan 27, 2024
1 parent 558e97a commit 1b533cd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/backend-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Backend Deployment

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: SSH into server and update code
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/ubuntu/.docker/datsmysong
git pull
- name: Stop containers
run: docker-compose -f /home/ubuntu/.docker/datsmysong/docker-compose.yml down

- name: Start containers
run: docker-compose -f /home/ubuntu/.docker/datsmysong/docker-compose.yml up -d

0 comments on commit 1b533cd

Please sign in to comment.