Skip to content

Commit 3eee70d

Browse files
authored
feat: publish tag without patch version (astral-sh#6734)
## Summary Closes astral-sh#6678 This change would publish an additional tag that includes only `major.minor`. For a release with x.y.z, this would publish the tags: * `ghcr.io/astral-sh/uv:latest` * `ghcr.io/astral-sh/uv:x.y.z` * `ghcr.io/astral-sh/uv:x.y`
1 parent f96b4c7 commit 3eee70d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/build-docker.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ jobs:
118118
uses: docker/metadata-action@v5
119119
with:
120120
images: ${{ env.UV_BASE_IMG }}
121+
tags: |
122+
type=pep440,pattern={{ version }},value=${{ fromJson(inputs.plan).announcement_tag }}
123+
type=pep440,pattern={{ major }}.{{ minor }},value=${{ fromJson(inputs.plan).announcement_tag }}
121124
122125
- uses: docker/login-action@v3
123126
with:
@@ -128,8 +131,10 @@ jobs:
128131
# Adapted from https://docs.docker.com/build/ci/github-actions/multi-platform/
129132
- name: Create manifest list and push
130133
working-directory: /tmp/digests
134+
# The jq command expands the docker/metadata json "tags" array entry to `-t tag1 -t tag2 ...` for each tag in the array
135+
# The printf will expand the base image with the `<UV_BASE_IMG>@sha256:<sha256> ...` for each sha256 in the directory
136+
# The final command becomes `docker buildx imagetools create -t tag1 -t tag2 ... <UV_BASE_IMG>@sha256:<sha256_1> <UV_BASE_IMG>@sha256:<sha256_2> ...`
131137
run: |
132138
docker buildx imagetools create \
133-
-t ${{ env.UV_BASE_IMG }}:latest \
134-
-t ${{ env.UV_BASE_IMG }}:${{ (inputs.plan != '' && fromJson(inputs.plan).announcement_tag) || 'dry-run' }} \
139+
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
135140
$(printf '${{ env.UV_BASE_IMG }}@sha256:%s ' *)

0 commit comments

Comments
 (0)