diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..19e6c0f --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -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/ssh-agent@v0.5.4 + 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" diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100644 index 0000000..1b4942c --- /dev/null +++ b/scripts/deploy.sh @@ -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."