diff --git a/.github/workflows/est-frontend-dev.yml b/.github/workflows/est-frontend-dev.yml new file mode 100644 index 00000000..4e798c75 --- /dev/null +++ b/.github/workflows/est-frontend-dev.yml @@ -0,0 +1,41 @@ +name: Deploy Frontend + +on: + push: + branches: + - dev + +jobs: + deploy: + runs-on: [self-hosted, est-cls-dev] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Remove all running containers, images, and prune Docker system + run: | + docker stop $(docker ps -a -q) || true + docker rm $(docker ps -a -q) || true + docker rmi $(docker images -q) || true + docker system prune -af + + - name: Build and run Docker Compose + run: | + cd GUI + docker-compose up --build -d + + - name: Get public IP address + id: get_ip + run: | + PUBLIC_IP=$(curl -s http://checkip.amazonaws.com) + echo "PUBLIC_IP=$PUBLIC_IP" >> $GITHUB_ENV + + - name: Send Slack notification + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + PUBLIC_IP: ${{ env.PUBLIC_IP }} + run: | + curl -X POST -H 'Content-type: application/json' --data "{ + \"text\": \"Build is complete. Public IP: $PUBLIC_IP\" + }" $SLACK_WEBHOOK_URL