CD Pipeline #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CD Pipeline | |
| on: | |
| workflow_run: | |
| workflows: ["CI Pipeline"] | |
| types: | |
| - completed | |
| branches: [main] | |
| jobs: | |
| deploy: | |
| runs-on: self-hosted | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| # - name: Checkout code | |
| # uses: actions/checkout@v3 | |
| - name: Login to Docker Hub | |
| run: | | |
| echo "${{ secrets.DOCKER_PASSWORD }}" | sudo docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| - name: Setup config directories | |
| run: | | |
| sudo rm -rf App-Setup # Remove existing App-Setup folder | |
| git clone https://github.com/hydex-org/App-Setup.git | |
| cd App-Setup | |
| ./initial-setup.bash | |
| ls -a | |
| - name: Stop existing containers | |
| working-directory: App-Setup | |
| run: sudo docker compose -f docker-compose.yml down --remove-orphans || true | |
| - name: Start services | |
| working-directory: App-Setup | |
| run: sudo docker compose -f docker-compose.yml up -d | |
| - name: Wait for services to be healthy | |
| working-directory: App-Setup | |
| run: | | |
| echo "Waiting for services to start..." | |
| sleep 15 | |
| sudo docker compose -f docker-compose.yml ps | |
| - name: Show service logs (last 20 lines each) | |
| if: always() | |
| working-directory: App-Setup | |
| run: | | |
| echo "=== Bridge API logs ===" | |
| sudo docker compose -f docker-compose.yml logs --tail=20 bridge-api || true | |
| echo "=== Enclave logs ===" | |
| sudo docker compose -f docker-compose.yml logs --tail=20 enclave || true | |
| echo "=== MPC Node 1 logs ===" | |
| sudo docker compose -f docker-compose.yml logs --tail=20 mpc-node1 || true | |
| - name: Verify deployment health | |
| working-directory: App-Setup | |
| run: | | |
| echo "Checking container health status..." | |
| unhealthy=$(sudo docker compose -f docker-compose.yml ps --format json | grep -c '"Health":"unhealthy"' || echo "0") | |
| if [ "$unhealthy" -gt 0 ]; then | |
| echo "WARNING: Some containers are unhealthy" | |
| sudo docker compose -f docker-compose.yml ps | |
| exit 1 | |
| fi | |
| echo "All containers are healthy!" |