Skip to content

Commit

Permalink
Merge pull request #40 from ylavoie/push-on-merge-only1
Browse files Browse the repository at this point in the history
Check if pull request is merged into master
  • Loading branch information
ylavoie authored Oct 30, 2023
2 parents 561c29d + b2b9565 commit 25d3883
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check if pull request is merged into master
id: check-merge
run: |
from_branch="${{ github.event.pull_request.head.ref }}"
to_branch="${{ github.event.pull_request.base.ref }}"
echo "{is_merge_into_master}={"$from_branch" != "$to_branch" && "$to_branch" == "master"}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
push: ${{ github.event.pull_request.merged == true }}
push: ${{ steps.check-merge.outputs.is_merge_into_master == 'true' }}
tags: ghcr.io/${{github.repository_owner}}/ledgersmb_circleci-perl:${{ matrix.version }}
build-args: |
perl=${{ matrix.version }}
Expand All @@ -49,10 +55,16 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check if pull request is merged into master
id: check-merge
run: |
from_branch="${{ github.event.pull_request.head.ref }}"
to_branch="${{ github.event.pull_request.base.ref }}"
echo "{is_merge_into_master}={"$from_branch" != "$to_branch" && "$to_branch" == "master"}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
push: ${{ github.event.pull_request.merged == true }}
push: ${{ steps.check-merge.outputs.is_merge_into_master == 'true' }}
tags: ghcr.io/${{github.repository_owner}}/ledgersmb_circleci-postgres:${{ matrix.version }}
build-args: |
version=${{ matrix.version }}
Expand Down

0 comments on commit 25d3883

Please # to comment.