Merge pull request #145 from bio-xyz/feat/claude-4.6-migration #33
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: Deploy Worker | |
| on: | |
| push: | |
| branches: [dev, main] | |
| paths: | |
| - 'src/**' | |
| - 'client/**' | |
| - 'Dockerfile' | |
| - 'package.json' | |
| - 'bun.lockb' | |
| - 'docker-compose.yml' | |
| - 'docker-compose.swarm.yml' | |
| - 'docker-compose.worker.yml' | |
| - '.github/workflows/deploy-worker.yml' | |
| # Allow manual trigger with options | |
| workflow_dispatch: | |
| inputs: | |
| no_cache: | |
| description: 'Build without cache (fresh build)' | |
| required: false | |
| default: 'false' | |
| type: boolean | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: biosagent | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| # Dev branch: tag as 'dev' and commit SHA | |
| - name: Build and Push (dev) | |
| if: github.ref == 'refs/heads/dev' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| biosagent/bios:dev | |
| biosagent/bios:dev-${{ github.sha }} | |
| no-cache: true | |
| # Main branch: tag as 'latest' and commit SHA | |
| - name: Build and Push (main) | |
| if: github.ref == 'refs/heads/main' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| biosagent/bios:latest | |
| biosagent/bios:${{ github.sha }} | |
| no-cache: true | |
| # Trigger dev webhook with specific image tag to avoid stale cache | |
| - name: Trigger Portainer Webhook (dev) | |
| if: github.ref == 'refs/heads/dev' | |
| run: | | |
| curl -X POST "${{ secrets.PORTAINER_WEBHOOK_URL_DEV }}?tag=dev-${{ github.sha }}" -k --fail --silent --show-error | |
| echo "Dev webhook triggered with tag: dev-${{ github.sha }}" | |
| # Trigger production webhook with specific image tag to avoid stale cache | |
| - name: Trigger Portainer Webhook (main) | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| curl -X POST "${{ secrets.PORTAINER_WEBHOOK_URL }}?tag=${{ github.sha }}" -k --fail --silent --show-error | |
| echo "Production webhook triggered with tag: ${{ github.sha }}" | |
| - name: Summary | |
| run: | | |
| echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ github.ref }}" == "refs/heads/dev" ]; then | |
| echo "- **Image:** biosagent/bios:dev-${{ github.sha }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Environment:** Development" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "- **Image:** biosagent/bios:${{ github.sha }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Environment:** Production" >> $GITHUB_STEP_SUMMARY | |
| fi |