Skip to content

Commit 5fb7133

Browse files
pRizzcursoragent
andcommitted
ci(docker): add metadata-action for tags
Generate Docker tags and labels with docker/metadata-action and feed them into the publish build for consistent tagging. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent c8673b5 commit 5fb7133

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ jobs:
8181
# The Dockerfile is embedded in the Rust source
8282
cp packages/core/src/docker/Dockerfile .
8383
84+
- name: Docker metadata
85+
id: meta
86+
uses: docker/metadata-action@v5
87+
with:
88+
images: |
89+
${{ env.IMAGE_NAME_GHCR }}
90+
${{ env.IMAGE_NAME_DOCKERHUB }}
91+
tags: |
92+
type=semver,pattern={{version}},value=${{ steps.version.outputs.version }}
93+
type=raw,value=latest
94+
8495
# Build and test BEFORE authenticating to registries
8596
# If smoke test fails, we don't waste time on login steps
8697

@@ -95,6 +106,8 @@ jobs:
95106
OPENCODE_CLOUD_VERSION=${{ steps.version.outputs.version }}
96107
tags: |
97108
${{ env.IMAGE_NAME_GHCR }}:test
109+
# Separate cache scope to avoid overwriting the main publish build cache.
110+
# GHA cache v2 is the recommended backend going forward.
98111
cache-from: type=gha,scope=opencode-cloud-sandbox-test,version=2
99112
cache-to: type=gha,scope=opencode-cloud-sandbox-test,mode=max,version=2
100113

@@ -177,11 +190,10 @@ jobs:
177190
platforms: linux/amd64,linux/arm64
178191
build-args: |
179192
OPENCODE_CLOUD_VERSION=${{ steps.version.outputs.version }}
180-
tags: |
181-
${{ env.IMAGE_NAME_GHCR }}:${{ steps.version.outputs.version }}
182-
${{ env.IMAGE_NAME_GHCR }}:latest
183-
${{ env.IMAGE_NAME_DOCKERHUB }}:${{ steps.version.outputs.version }}
184-
${{ env.IMAGE_NAME_DOCKERHUB }}:latest
193+
tags: ${{ steps.meta.outputs.tags }}
194+
labels: ${{ steps.meta.outputs.labels }}
195+
# Scoped cache prevents thrash between test and publish builds.
196+
# GHA cache v2 improves compatibility with the current cache API.
185197
cache-from: type=gha,scope=opencode-cloud-sandbox,version=2
186198
cache-to: type=gha,scope=opencode-cloud-sandbox,mode=max,version=2
187199

0 commit comments

Comments
 (0)