|
| 1 | +name: Build and Deploy Company Research Agent |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop ] |
| 6 | + paths: |
| 7 | + - 'samples/company-research-agent/**' |
| 8 | + pull_request: |
| 9 | + branches: [ main ] |
| 10 | + paths: |
| 11 | + - 'samples/company-research-agent/**' |
| 12 | + |
| 13 | +env: |
| 14 | + REGISTRY: ghcr.io |
| 15 | + IMAGE_NAME: ${{ github.repository }}/company-research-agent |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + permissions: |
| 21 | + contents: read |
| 22 | + packages: write |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Log in to Container Registry |
| 29 | + uses: docker/login-action@v3 |
| 30 | + with: |
| 31 | + registry: ${{ env.REGISTRY }} |
| 32 | + username: ${{ github.actor }} |
| 33 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + |
| 35 | + - name: Extract metadata |
| 36 | + id: meta |
| 37 | + uses: docker/metadata-action@v5 |
| 38 | + with: |
| 39 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 40 | + tags: | |
| 41 | + type=ref,event=branch |
| 42 | + type=ref,event=pr |
| 43 | + type=sha,prefix=sha- |
| 44 | +
|
| 45 | + - name: Build and push Docker image |
| 46 | + uses: docker/build-push-action@v5 |
| 47 | + with: |
| 48 | + context: ./samples/company-research-agent |
| 49 | + push: true |
| 50 | + tags: ${{ steps.meta.outputs.tags }} |
| 51 | + labels: ${{ steps.meta.outputs.labels }} |
| 52 | + build-args: | |
| 53 | + CLIENT_ID=${{ secrets.UIPATH_CLIENT_ID }} |
| 54 | + CLIENT_SECRET=${{ secrets.UIPATH_CLIENT_SECRET }} |
| 55 | + BASE_URL=${{ secrets.UIPATH_BASE_URL }} |
| 56 | + ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }} |
| 57 | + TAVILY_API_KEY=${{ secrets.TAVILY_API_KEY }} |
| 58 | +
|
| 59 | + test: |
| 60 | + runs-on: ubuntu-latest |
| 61 | + needs: build |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Checkout repository |
| 65 | + uses: actions/checkout@v4 |
| 66 | + |
| 67 | + - name: Run container tests |
| 68 | + run: | |
| 69 | + docker run --rm \ |
| 70 | + -e CLIENT_ID=${{ secrets.UIPATH_CLIENT_ID }} \ |
| 71 | + -e CLIENT_SECRET=${{ secrets.UIPATH_CLIENT_SECRET }} \ |
| 72 | + -e BASE_URL=${{ secrets.UIPATH_BASE_URL }} \ |
| 73 | + -e ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }} \ |
| 74 | + -e TAVILY_API_KEY=${{ secrets.TAVILY_API_KEY }} \ |
| 75 | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \ |
| 76 | + /bin/bash -c "echo 'Container health check passed'" |
| 77 | +
|
| 78 | + deploy: |
| 79 | + runs-on: ubuntu-latest |
| 80 | + needs: [build, test] |
| 81 | + if: github.ref == 'refs/heads/main' |
| 82 | + |
| 83 | + steps: |
| 84 | + - name: Deploy to production |
| 85 | + run: | |
| 86 | + echo "Deploying to production..." |
| 87 | + # Add your deployment commands here |
| 88 | + # For example, deploy to Azure Container Instances, AWS ECS, or Kubernetes |
0 commit comments