Skip to content

Commit 6660806

Browse files
authored
fix: pass proper ref to metadata-action (#298)
When not using a custom value, `docker/metadata-action` takes the ref from `github.ref`. However, the value of that is `refs/heads/main` when the workflow is triggered by `workflow_run`. That cannot be parsed into a semver, and the result is no tags in metadata, which then makes the docker push fail. The fix is to extract the value from what the `Determine ref` step determines (which is the one that Releaser inferred from `version.json`). A match regex is also provided so that both `v1.2.3` (what we will get when `workflow_run`) and `refs/tags/v1.2.3` (what we will get when pushing a tag) work.
1 parent f52a984 commit 6660806

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/workflows/publish-ghcr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ jobs:
142142
with:
143143
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
144144
tags: |
145-
type=semver,pattern={{version}}
145+
type=semver,pattern={{version}},value=${{ steps.ref.outputs.ref }},match=v[0-9].*
146146
147147
- name: Build and push
148148
uses: docker/build-push-action@v6

0 commit comments

Comments
 (0)