Skip to content

Commit 1a1b296

Browse files
committed
Run docker build on all PRs, but only push image on merge
Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
1 parent 46a7409 commit 1a1b296

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/docker_main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ name: Docker Main Build
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
78

89
jobs:
910
docker:
@@ -32,14 +33,17 @@ jobs:
3233
--tag ghcr.io/hyperledger/firefly-tokens-erc1155:${{ steps.build_tag_generator.outputs.BUILD_TAG }} .
3334
3435
- name: Tag release
36+
if: github.event.pull_request.merged == true
3537
run: docker tag ghcr.io/hyperledger/firefly-tokens-erc1155:${{ steps.build_tag_generator.outputs.BUILD_TAG }} ghcr.io/hyperledger/firefly-tokens-erc1155:head
3638

3739
- name: Push docker image
40+
if: github.event.pull_request.merged == true
3841
run: |
3942
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
4043
docker push ghcr.io/hyperledger/firefly-tokens-erc1155:${{ steps.build_tag_generator.outputs.BUILD_TAG }}
4144
4245
- name: Push head tag
46+
if: github.event.pull_request.merged == true
4347
run: |
4448
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
4549
docker push ghcr.io/hyperledger/firefly-tokens-erc1155:head

0 commit comments

Comments
 (0)