Build Indexer #30
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: Build Indexer | |
| env: | |
| BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
| on: | |
| push: | |
| branches: [develop, staging, main] | |
| paths: | |
| - "apps/indexer/*" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| call-workflow-init: | |
| uses: DistributedCollective/.github/.github/workflows/init.yml@v3_staging | |
| with: | |
| ref: ${{ github.ref }} | |
| base_ref: ${{ github.base_ref }} | |
| build: | |
| needs: call-workflow-init | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| node-version: [24.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| run_install: false | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: "pnpm" | |
| - name: Install Dependencies | |
| run: pnpm install | |
| # Login against a Docker registry except on PR | |
| # https://github.com/docker/login-action | |
| - name: Login to registry ${{ needs.call-workflow-init.outputs.registry }} | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3.0.0 | |
| with: | |
| registry: ${{ needs.call-workflow-init.outputs.registry }} | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| # Extract metadata (tags, labels) for Docker | |
| # https://github.com/docker/metadata-action | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5.0.0 | |
| with: | |
| images: ${{ needs.call-workflow-init.outputs.registry }}/${{ needs.call-workflow-init.outputs.image_name }} | |
| - name: Build indexer | |
| run: pnpm nx build indexer | |
| # Build and push Docker image with Buildx (don't push on PR) | |
| # https://github.com/docker/build-push-action | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5.0.0 | |
| with: | |
| context: . | |
| file: ${{ needs.call-workflow-init.outputs.dockerfile_path }}/Dockerfile.indexer | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ needs.call-workflow-init.outputs.registry }}/${{ needs.call-workflow-init.outputs.image_name }}:${{ ENV.BRANCH_NAME }} | |
| labels: ${{ steps.meta.outputs.labels }} |