|
81 | 81 | # The Dockerfile is embedded in the Rust source |
82 | 82 | cp packages/core/src/docker/Dockerfile . |
83 | 83 |
|
| 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 | +
|
84 | 95 | # Build and test BEFORE authenticating to registries |
85 | 96 | # If smoke test fails, we don't waste time on login steps |
86 | 97 |
|
|
95 | 106 | OPENCODE_CLOUD_VERSION=${{ steps.version.outputs.version }} |
96 | 107 | tags: | |
97 | 108 | ${{ 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. |
98 | 111 | cache-from: type=gha,scope=opencode-cloud-sandbox-test,version=2 |
99 | 112 | cache-to: type=gha,scope=opencode-cloud-sandbox-test,mode=max,version=2 |
100 | 113 |
|
@@ -177,11 +190,10 @@ jobs: |
177 | 190 | platforms: linux/amd64,linux/arm64 |
178 | 191 | build-args: | |
179 | 192 | 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. |
185 | 197 | cache-from: type=gha,scope=opencode-cloud-sandbox,version=2 |
186 | 198 | cache-to: type=gha,scope=opencode-cloud-sandbox,mode=max,version=2 |
187 | 199 |
|
|
0 commit comments