@@ -305,12 +305,10 @@ jobs:
305305 run : |
306306 TAG=$(echo "${{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
307307 TAGS="-t $TAG"
308-
309308 # Add latest tag only if building from a tag
310309 if [[ "${{ github.ref }}" == refs/tags/* ]]; then
311310 TAGS="$TAGS -t latest"
312311 fi
313-
314312 KO_DOCKER_REPO=$BASE_REPO ko build --platform=linux/amd64,linux/arm64 --bare $TAGS ./cmd/thv-proxyrunner \
315313 --image-label=org.opencontainers.image.source=https://github.com/stacklok/toolhive,org.opencontainers.image.title="toolhive-proxyrunner",org.opencontainers.image.vendor=Stacklok
316314
@@ -321,7 +319,87 @@ jobs:
321319 TAG=$(echo "${{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
322320 # Sign the ko image
323321 cosign sign -y $BASE_REPO:$TAG
324-
322+
323+ # Sign the latest tag if building from a tag
324+ if [[ "${{ github.ref }}" == refs/tags/* ]]; then
325+ cosign sign -y $BASE_REPO:latest
326+ fi
327+
328+ vmcp-image-build-and-publish :
329+ name : Build and Publish Virtual MCP Server Image
330+ runs-on : ubuntu-latest
331+ permissions :
332+ contents : write
333+ packages : write
334+ id-token : write
335+
336+ env :
337+ BASE_REPO : " ghcr.io/stacklok/toolhive/vmcp"
338+
339+ steps :
340+ - name : Checkout repository
341+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
342+
343+ - name : Set up Go
344+ uses : actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
345+ with :
346+ go-version-file : go.mod
347+
348+ - name : Compute version number
349+ id : version-string
350+ run : |
351+ if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
352+ # For main branch, use semver with -dev suffix
353+ echo "tag=0.0.1-dev.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
354+ elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
355+ # For tags, use the tag as is (assuming it's semver)
356+ TAG="${{ github.ref_name }}"
357+ echo "tag=$TAG" >> "$GITHUB_OUTPUT"
358+ else
359+ # For other branches, use branch name and run number
360+ BRANCH="${{ github.ref_name }}"
361+ echo "tag=0.0.1-$BRANCH.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
362+ fi
363+
364+ - name : Login to GitHub Container Registry
365+ uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
366+ with :
367+ registry : ghcr.io
368+ username : ${{ github.actor }}
369+ password : ${{ secrets.GITHUB_TOKEN }}
370+
371+ - name : Setup ko
372+ uses : ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
373+
374+ - name : Install Cosign
375+ uses : sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1
376+
377+ - name : Build and Push Image to GHCR
378+ env :
379+ VERSION : ${{ steps.version-string.outputs.tag }}
380+ COMMIT : ${{ github.sha }}
381+ BUILD_DATE : ${{ github.event.head_commit.timestamp }}
382+ KO_CONFIG_PATH : ${{ github.workspace }}/.github/ko-ci.yml
383+ run : |
384+ TAG=$(echo "${{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
385+ TAGS="-t $TAG"
386+
387+ # Add latest tag only if building from a tag
388+ if [[ "${{ github.ref }}" == refs/tags/* ]]; then
389+ TAGS="$TAGS -t latest"
390+ fi
391+
392+ KO_DOCKER_REPO=$BASE_REPO ko build --platform=linux/amd64,linux/arm64 --bare $TAGS ./cmd/vmcp \
393+ --image-label=org.opencontainers.image.source=https://github.com/stacklok/toolhive,org.opencontainers.image.title="toolhive-vmcp",org.opencontainers.image.vendor=Stacklok
394+
395+ - name : Sign Image with Cosign
396+ # This step uses the identity token to provision an ephemeral certificate
397+ # against the sigstore community Fulcio instance.
398+ run : |
399+ TAG=$(echo "${{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
400+ # Sign the ko image
401+ cosign sign -y $BASE_REPO:$TAG
402+
325403 # Sign the latest tag if building from a tag
326404 if [[ "${{ github.ref }}" == refs/tags/* ]]; then
327405 cosign sign -y $BASE_REPO:latest
0 commit comments