Skip to content

Commit 5d6c655

Browse files
kratsgclaude
andcommitted
fix: handle docker-v prefix in version tags
Added configurable prefix field to each component to properly handle different tag formats. Docker/moby tags are formatted as docker-v29.0.1 while others use just v2.329.0. Changes: - Added prefix field to each component in COMPONENTS JSON - Updated fetch step to extract and strip the appropriate prefix - Docker now uses docker-v prefix, others use v - Uses bash parameter expansion instead of tr - More robust and handles any prefix format This fixes the issue where Docker versions were not being parsed correctly from moby/moby release tags. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9491e1e commit 5d6c655

2 files changed

Lines changed: 24 additions & 12 deletions

File tree

.github/workflows/update-versions.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ on:
99
env:
1010
COMPONENTS: >-
1111
[
12-
{"var": "RUNNER_VERSION", "repo": "actions/runner", "name": "Runner"},
12+
{"var": "RUNNER_VERSION", "repo": "actions/runner", "name": "Runner",
13+
"prefix": "v"},
1314
{"var": "RUNNER_CONTAINER_HOOKS_VERSION", "repo":
14-
"actions/runner-container-hooks", "name": "Container Hooks"},
15-
{"var": "DOCKER_VERSION", "repo": "moby/moby", "name": "Docker"},
16-
{"var": "BUILDX_VERSION", "repo": "docker/buildx", "name": "Buildx"}
17-
]
15+
"actions/runner-container-hooks", "name": "Container Hooks", "prefix": "v"},
16+
{"var": "DOCKER_VERSION", "repo": "moby/moby", "name": "Docker", "prefix":
17+
"docker-v"},
18+
{"var": "BUILDX_VERSION", "repo": "docker/buildx", "name": "Buildx",
19+
"prefix": "v"} ]
1820
1921
jobs:
2022
update-versions:
@@ -48,9 +50,11 @@ jobs:
4850
echo "$COMPONENTS" | jq -c '.[]' | while read -r component; do
4951
VAR=$(echo "$component" | jq -r '.var')
5052
REPO=$(echo "$component" | jq -r '.repo')
51-
LATEST=$(gh api repos/$REPO/releases -q '.[0].tag_name' | tr -d 'v')
53+
PREFIX=$(echo "$component" | jq -r '.prefix')
54+
TAG=$(gh api repos/$REPO/releases -q '.[0].tag_name')
55+
LATEST="${TAG#$PREFIX}" # Strip prefix from tag
5256
echo "LATEST_$VAR=$LATEST" >> $GITHUB_ENV
53-
echo "Fetched $VAR: $LATEST from $REPO"
57+
echo "Fetched $VAR: $LATEST from $REPO (tag: $TAG)"
5458
done
5559
5660
- name: Update .env if needed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,23 @@ To add a new component for automated version tracking:
114114
env:
115115
COMPONENTS: >-
116116
[
117-
{"var": "RUNNER_VERSION", "repo": "actions/runner", "name": "Runner"},
117+
{"var": "RUNNER_VERSION", "repo": "actions/runner", "name": "Runner",
118+
"prefix": "v"},
118119
{"var": "RUNNER_CONTAINER_HOOKS_VERSION", "repo":
119-
"actions/runner-container-hooks", "name": "Container Hooks"},
120-
{"var": "DOCKER_VERSION", "repo": "moby/moby", "name": "Docker"},
121-
{"var": "BUILDX_VERSION", "repo": "docker/buildx", "name": "Buildx"},
120+
"actions/runner-container-hooks", "name": "Container Hooks", "prefix":
121+
"v"},
122+
{"var": "DOCKER_VERSION", "repo": "moby/moby", "name": "Docker",
123+
"prefix": "docker-v"},
124+
{"var": "BUILDX_VERSION", "repo": "docker/buildx", "name": "Buildx",
125+
"prefix": "v"},
122126
{"var": "NEW_COMPONENT_VERSION", "repo": "org/repo", "name": "Friendly
123-
Name"} ]
127+
Name", "prefix": "v"} ]
124128
```
125129
130+
The `prefix` field specifies what to strip from the release tag to get the
131+
version number (e.g., `v2.329.0` → `2.329.0`, or `docker-v29.0.1` →
132+
`29.0.1`).
133+
126134
3. **(Optional) Update README.md** to document the new component:
127135
- Add to the Configuration section's `.env` example
128136
- Add to the Versioning Concepts section with description

0 commit comments

Comments
 (0)