name: 'Build: Benchmark Image'

on:
  workflow_dispatch:
  push:
    branches:
      - master
    paths:
      - 'packages/@n8n/benchmark/**'
      - 'pnpm-lock.yaml'
      - 'pnpm-workspace.yaml'
      - '.github/workflows/build-benchmark-image.yml'

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Set up QEMU
        uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0

      - name: Login to GitHub Container Registry
        uses: ./.github/actions/docker-registry-login

      - name: Build
        uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
        env:
          DOCKER_BUILD_SUMMARY: false
        with:
          context: .
          file: ./packages/@n8n/benchmark/Dockerfile
          platforms: linux/amd64
          provenance: false
          push: true
          tags: |
            ghcr.io/${{ github.repository_owner }}/n8n-benchmark:latest
