Skip to content

Commit a6ac3a4

Browse files
committed
temp commit
1 parent 4ef9d1b commit a6ac3a4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/build-docker-image.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ concurrency:
3434

3535
jobs:
3636
build:
37-
if: github.repository == 'apache/cloudstack-kubernetes-provider' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
37+
if: github.repository == 'apache/cloudstack-kubernetes-provider'
3838
runs-on: ubuntu-22.04
3939
steps:
4040
- name: Set Docker repository name
@@ -50,10 +50,20 @@ jobs:
5050
- name: Set Docker image FULL TAG
5151
run: echo "FULL_TAG=$(if [ "${{ secrets.DOCKER_REGISTRY }}" = "" ];then echo ${DOCKER_REPOSITORY}/cloudstack-kubernetes-provider:${TAG};else echo ${{ secrets.DOCKER_REGISTRY }}/${DOCKER_REPOSITORY}/cloudstack-kubernetes-provider:${TAG};fi)" >> $GITHUB_ENV
5252

53+
- name: Check if should push
54+
id: should_push
55+
run: |
56+
if [ "${{ github.event_name }}" != "pull_request" ] || [ "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]; then
57+
echo "should_push=true" >> $GITHUB_OUTPUT
58+
else
59+
echo "should_push=false" >> $GITHUB_OUTPUT
60+
fi
61+
5362
- name: Set up Docker Buildx
5463
uses: docker/setup-buildx-action@v3
5564

5665
- name: Login to Docker Registry
66+
if: steps.should_push.outputs.should_push == 'true'
5767
uses: docker/login-action@v3
5868
with:
5969
registry: ${{ secrets.DOCKER_REGISTRY }}
@@ -66,7 +76,7 @@ jobs:
6676
context: .
6777
file: ./Dockerfile
6878
platforms: linux/amd64,linux/arm64
69-
push: true
79+
push: ${{ steps.should_push.outputs.should_push == 'true' }}
7080
tags: ${{ env.FULL_TAG }}
7181
cache-from: type=registry,ref=${{ env.FULL_TAG }}-cache
7282
cache-to: type=registry,ref=${{ env.FULL_TAG }}-cache,mode=max

0 commit comments

Comments
 (0)