|
| 1 | +name: Build Indexer |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [develop, staging, main] |
| 6 | + paths: |
| 7 | + - 'apps/indexer/*' |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + call-workflow-init: |
| 16 | + uses: DistributedCollective/.github/.github/workflows/init.yml@v3_staging |
| 17 | + with: |
| 18 | + ref: ${{ github.ref }} |
| 19 | + base_ref: ${{ github.base_ref }} |
| 20 | + |
| 21 | + build: |
| 22 | + needs: call-workflow-init |
| 23 | + runs-on: ubuntu-latest |
| 24 | + permissions: |
| 25 | + contents: read |
| 26 | + packages: write |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + node-version: [24.x] |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Install pnpm |
| 35 | + uses: pnpm/action-setup@v4 |
| 36 | + with: |
| 37 | + version: 10 |
| 38 | + run_install: false |
| 39 | + |
| 40 | + - name: Use Node.js ${{ matrix.node-version }} |
| 41 | + uses: actions/setup-node@v4 |
| 42 | + with: |
| 43 | + node-version: ${{ matrix.node-version }} |
| 44 | + cache: 'pnpm' |
| 45 | + |
| 46 | + - name: Install Dependencies |
| 47 | + run: pnpm install |
| 48 | + |
| 49 | + # Login against a Docker registry except on PR |
| 50 | + # https://github.com/docker/login-action |
| 51 | + - name: Login to registry ${{ needs.call-workflow-init.outputs.registry }} |
| 52 | + if: github.event_name != 'pull_request' |
| 53 | + uses: docker/login-action@v3.0.0 |
| 54 | + with: |
| 55 | + registry: ${{ needs.call-workflow-init.outputs.registry }} |
| 56 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 57 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 58 | + |
| 59 | + # Extract metadata (tags, labels) for Docker |
| 60 | + # https://github.com/docker/metadata-action |
| 61 | + - name: Extract Docker metadata |
| 62 | + id: meta |
| 63 | + uses: docker/metadata-action@v5.0.0 |
| 64 | + with: |
| 65 | + images: ${{ needs.call-workflow-init.outputs.registry }}/${{ needs.call-workflow-init.outputs.image_name }} |
| 66 | + |
| 67 | + - name: Build indexer |
| 68 | + run: pnpm nx build indexer |
| 69 | + |
| 70 | + # Build and push Docker image with Buildx (don't push on PR) |
| 71 | + # https://github.com/docker/build-push-action |
| 72 | + - name: Build and push Docker image |
| 73 | + uses: docker/build-push-action@v5.0.0 |
| 74 | + with: |
| 75 | + context: . |
| 76 | + file: ${{ needs.call-workflow-init.outputs.dockerfile_path }}/Dockerfile.indexer |
| 77 | + push: ${{ github.event_name != 'pull_request' }} |
| 78 | + tags: ${{ needs.call-workflow-init.outputs.registry }}/${{ needs.call-workflow-init.outputs.image_name }}:${{ needs.call-workflow-init.outputs.KUBE_NAMESPACE }} |
| 79 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments