From e05f668096d7b7d270176689e4748793769fc635 Mon Sep 17 00:00:00 2001 From: Matthew Whitehead Date: Thu, 19 Sep 2024 09:44:22 +0100 Subject: [PATCH] Run docker build on all PRs, but only push image on merge Signed-off-by: Matthew Whitehead --- .github/workflows/docker_main.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker_main.yml b/.github/workflows/docker_main.yml index cb72b20..ef2fa40 100644 --- a/.github/workflows/docker_main.yml +++ b/.github/workflows/docker_main.yml @@ -2,8 +2,9 @@ name: Docker Main Build on: push: - branches: - - main + branches: [main] + pull_request: + branches: [main] jobs: docker: @@ -32,14 +33,17 @@ jobs: --tag ghcr.io/hyperledger/firefly-tokens-erc1155:${{ steps.build_tag_generator.outputs.BUILD_TAG }} . - name: Tag release + if: github.event.pull_request.merged == true run: docker tag ghcr.io/hyperledger/firefly-tokens-erc1155:${{ steps.build_tag_generator.outputs.BUILD_TAG }} ghcr.io/hyperledger/firefly-tokens-erc1155:head - name: Push docker image + if: github.event.pull_request.merged == true run: | echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin docker push ghcr.io/hyperledger/firefly-tokens-erc1155:${{ steps.build_tag_generator.outputs.BUILD_TAG }} - name: Push head tag + if: github.event.pull_request.merged == true run: | echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin docker push ghcr.io/hyperledger/firefly-tokens-erc1155:head