fix: update CI configuration to conditionally push Docker images

- Modify the CI configuration to push the Docker image only when it is not a pull request event.
- Added conditional judgment for the DockerHub login step to ensure that no push operation is executed during pull request events.

Signed-off-by: samzong <samzong.lu@gmail.com>
main
samzong 4 months ago
parent 34e17bc304
commit 0a08075201
No known key found for this signature in database
GPG Key ID: 75DD23A14F1B7AF4

@ -29,6 +29,7 @@ jobs:
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Log in to DockerHub - name: Log in to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3.1.0 uses: docker/login-action@v3.1.0
with: with:
username: ${{ secrets.DOCKERHUB_TOKEN }} username: ${{ secrets.DOCKERHUB_TOKEN }}
@ -38,7 +39,7 @@ jobs:
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: ${{ github.event_name != 'pull_request' }}
tags: projecthami/hami-webui-fe-oss:${{ steps.branch-names.outputs.current_branch || steps.branch-names.outputs.tag }} tags: projecthami/hami-webui-fe-oss:${{ steps.branch-names.outputs.current_branch || steps.branch-names.outputs.tag }}
build-and-push-backend: build-and-push-backend:
@ -57,6 +58,7 @@ jobs:
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Log in to DockerHub - name: Log in to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3.1.0 uses: docker/login-action@v3.1.0
with: with:
username: ${{ secrets.DOCKERHUB_TOKEN }} username: ${{ secrets.DOCKERHUB_TOKEN }}
@ -67,5 +69,5 @@ jobs:
with: with:
context: ./server context: ./server
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: ${{ github.event_name != 'pull_request' }}
tags: projecthami/hami-webui-be-oss:${{ steps.branch-names.outputs.current_branch || steps.branch-names.outputs.tag }} tags: projecthami/hami-webui-be-oss:${{ steps.branch-names.outputs.current_branch || steps.branch-names.outputs.tag }}

Loading…
Cancel
Save