From 43edebf93b89e8ab72f847c57bdcd05f74949456 Mon Sep 17 00:00:00 2001 From: "Eric J. Smith" Date: Mon, 26 Oct 2026 09:55:12 -0500 Subject: [PATCH] Only publish Elasticsearch 8.x image from main Feature branches merging main re-triggered the push path filter whenever main touched this workflow, republishing :latest and the version tag from every branch. Match the 9.x workflow: build on PRs, publish only from main, and drop the unused .NET/minver steps so dependency bumps no longer touch this file. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/elasticsearch-docker-8.yml | 37 ++++++++------------ 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/.github/workflows/elasticsearch-docker-8.yml b/.github/workflows/elasticsearch-docker-8.yml index 29da4456db..663b9ddc30 100644 --- a/.github/workflows/elasticsearch-docker-8.yml +++ b/.github/workflows/elasticsearch-docker-8.yml @@ -1,46 +1,39 @@ name: Elasticsearch 8.x Docker Image CI on: + pull_request: + paths: + - "build/docker/elasticsearch/8.x/**" + - ".github/workflows/elasticsearch-docker-8.yml" push: + branches: [main] paths: - "build/docker/elasticsearch/8.x/**" - ".github/workflows/elasticsearch-docker-8.yml" + workflow_dispatch: + +permissions: + contents: read jobs: build: runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') != true - steps: - uses: actions/checkout@v7 - - name: Setup .NET Core - uses: actions/setup-dotnet@v6 - with: - dotnet-version: 10.0.402 - - name: Build Reason - env: - GITHUB_EVENT: ${{ toJson(github) }} - run: "echo ref: ${{github.ref}} event: ${{github.event_name}}" - - name: Build Version - run: | - dotnet tool install --global minver-cli --version 7.0.0 - version=$(minver --tag-prefix v) - echo "MINVERVERSIONOVERRIDE=$version" >> $GITHUB_ENV - echo "VERSION=$version" >> $GITHUB_ENV - echo "### Version: $version" >> $GITHUB_STEP_SUMMARY - name: Set up QEMU uses: docker/setup-qemu-action@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 - name: Login to DockerHub + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' uses: docker/login-action@v4 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 - with: - platforms: linux/amd64,linux/arm64 - name: Build custom Elasticsearch 8.x docker image working-directory: build/docker/elasticsearch/8.x + env: + PUBLISH: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }} run: | VERSION=$(sed -n 's/.*elasticsearch:\([^ ]*\).*/\1/p' Dockerfile) - docker buildx build --platform linux/amd64,linux/arm64 --output "type=image,push=true" --file ./Dockerfile . --tag exceptionless/elasticsearch:$VERSION --tag exceptionless/elasticsearch:latest + docker buildx build --platform linux/amd64,linux/arm64 --push="$PUBLISH" --file ./Dockerfile . --tag "exceptionless/elasticsearch:$VERSION" --tag exceptionless/elasticsearch:latest