Skip to content

Commit 5b281ba

Browse files
committed
be smarter than the dumb bot
1 parent 5a6a7e5 commit 5b281ba

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,24 @@ jobs:
5959

6060
# Extract metadata (tags, labels) for Docker
6161
# https://github.com/docker/metadata-action
62-
- name: Extract Docker metadata
62+
- name: Extract Docker metadata for PR
6363
id: meta
64+
if: github.event_name == 'pull_request'
6465
uses: docker/metadata-action@v5
6566
with:
6667
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
67-
tags: |
68-
${{ github.event_name == 'pull_request' ? 'pr-' + github.event.pull_request.number : steps.meta.outputs.tags }}
68+
tags:
69+
"pr-${{ github.event.pull_request.number }}"
70+
71+
- name: Extract Docker metadata for push
72+
id: meta
73+
if: github.event_name == 'push'
74+
uses: docker/metadata-action@v5
75+
with:
76+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
77+
tags:
78+
"latest"
79+
"${{ github.sha }}"
6980

7081
# Build and push Docker image with Buildx
7182
# https://github.com/docker/build-push-action

0 commit comments

Comments
 (0)