Skip to content

Commit

Permalink
add auto deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihohn committed Oct 15, 2024
1 parent 02ec4c7 commit 8ed8926
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy to Prod

on:
push:
branches:
- prod

jobs:
deploy:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Set up SSH to connect to server
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

# Step 3: Deploy the application
- name: Deploy to Prod Server
run: |
ssh ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_IP }} "cd /mnt/ptc/permissioning-city-engine && git pull origin prod && ./scripts/deploy.sh"
9 changes: 9 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
git pull origin prod
git submodule update

docker-compose down
docker-compose -f docker-compose.prod.yml up -d --build
docker system prune -f

echo "Deployment completed."

0 comments on commit 8ed8926

Please sign in to comment.