@@ -50,12 +50,12 @@ jobs:
5050 run : |
5151 TAG=${{ steps.version-string.outputs.tag }}
5252 TAGS="-t $TAG"
53-
53+
5454 # Add latest tag only if building from a tag
5555 if [[ "${{ github.ref }}" == refs/tags/* ]]; then
5656 TAGS="$TAGS -t latest"
5757 fi
58-
58+
5959 KO_DOCKER_REPO=$BASE_REPO ko build --platform=linux/amd64,linux/arm64 --bare $TAGS ./cmd/thv \
6060 --image-label=org.opencontainers.image.source=https://github.com/stacklok/toolhive,org.opencontainers.image.title="toolhive",org.opencontainers.image.vendor=Stacklok
6161
6666 TAG=${{ steps.version-string.outputs.tag }}
6767 # Sign the ko image
6868 cosign sign -y $BASE_REPO:$TAG
69-
69+
7070 # Sign the latest tag if building from a tag
7171 if [[ "${{ github.ref }}" == refs/tags/* ]]; then
7272 cosign sign -y $BASE_REPO:latest
@@ -204,12 +204,12 @@ jobs:
204204 run : |
205205 TAG=${{ steps.version-string.outputs.tag }}
206206 TAGS="-t $TAG"
207-
207+
208208 # Add latest tag only if building from a tag
209209 if [[ "${{ github.ref }}" == refs/tags/* ]]; then
210210 TAGS="$TAGS -t latest"
211211 fi
212-
212+
213213 KO_DOCKER_REPO=$BASE_REPO ko build --platform=linux/amd64,linux/arm64 --bare $TAGS ./cmd/thv-operator \
214214 --image-label=org.opencontainers.image.source=https://github.com/stacklok/toolhive,org.opencontainers.image.title="toolhive-operator",org.opencontainers.image.vendor=Stacklok
215215
@@ -236,7 +236,7 @@ jobs:
236236 # Sign the ko image
237237 cosign sign -y $BASE_REPO:$TAG
238238 cosign sign -y $BASE_REPO:$UBI_TAG
239-
239+
240240 # Sign the latest tag if building from a tag
241241 if [[ "${{ github.ref }}" == refs/tags/* ]]; then
242242 cosign sign -y $BASE_REPO:latest
@@ -303,12 +303,10 @@ jobs:
303303 run : |
304304 TAG=${{ steps.version-string.outputs.tag }}
305305 TAGS="-t $TAG"
306-
307306 # Add latest tag only if building from a tag
308307 if [[ "${{ github.ref }}" == refs/tags/* ]]; then
309308 TAGS="$TAGS -t latest"
310309 fi
311-
312310 KO_DOCKER_REPO=$BASE_REPO ko build --platform=linux/amd64,linux/arm64 --bare $TAGS ./cmd/thv-proxyrunner \
313311 --image-label=org.opencontainers.image.source=https://github.com/stacklok/toolhive,org.opencontainers.image.title="toolhive-proxyrunner",org.opencontainers.image.vendor=Stacklok
314312
@@ -335,7 +333,87 @@ jobs:
335333 # Sign the ko image
336334 cosign sign -y $BASE_REPO:$TAG
337335 cosign sign -y $BASE_REPO:$UBI_TAG
338-
336+
337+ # Sign the latest tag if building from a tag
338+ if [[ "${{ github.ref }}" == refs/tags/* ]]; then
339+ cosign sign -y $BASE_REPO:latest
340+ fi
341+
342+ vmcp-image-build-and-publish :
343+ name : Build and Publish Virtual MCP Server Image
344+ runs-on : ubuntu-latest
345+ permissions :
346+ contents : write
347+ packages : write
348+ id-token : write
349+
350+ env :
351+ BASE_REPO : " ghcr.io/stacklok/toolhive/vmcp"
352+
353+ steps :
354+ - name : Checkout repository
355+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
356+
357+ - name : Set up Go
358+ uses : actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
359+ with :
360+ go-version-file : go.mod
361+
362+ - name : Compute version number
363+ id : version-string
364+ run : |
365+ if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
366+ # For main branch, use semver with -dev suffix
367+ echo "tag=0.0.1-dev.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
368+ elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
369+ # For tags, use the tag as is (assuming it's semver)
370+ TAG="${{ github.ref_name }}"
371+ echo "tag=$TAG" >> "$GITHUB_OUTPUT"
372+ else
373+ # For other branches, use branch name and run number
374+ BRANCH="${{ github.ref_name }}"
375+ echo "tag=0.0.1-$BRANCH.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
376+ fi
377+
378+ - name : Login to GitHub Container Registry
379+ uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
380+ with :
381+ registry : ghcr.io
382+ username : ${{ github.actor }}
383+ password : ${{ secrets.GITHUB_TOKEN }}
384+
385+ - name : Setup ko
386+ uses : ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
387+
388+ - name : Install Cosign
389+ uses : sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1
390+
391+ - name : Build and Push Image to GHCR
392+ env :
393+ VERSION : ${{ steps.version-string.outputs.tag }}
394+ COMMIT : ${{ github.sha }}
395+ BUILD_DATE : ${{ github.event.head_commit.timestamp }}
396+ KO_CONFIG_PATH : ${{ github.workspace }}/.github/ko-ci.yml
397+ run : |
398+ TAG=$(echo "${{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
399+ TAGS="-t $TAG"
400+
401+ # Add latest tag only if building from a tag
402+ if [[ "${{ github.ref }}" == refs/tags/* ]]; then
403+ TAGS="$TAGS -t latest"
404+ fi
405+
406+ KO_DOCKER_REPO=$BASE_REPO ko build --platform=linux/amd64,linux/arm64 --bare $TAGS ./cmd/vmcp \
407+ --image-label=org.opencontainers.image.source=https://github.com/stacklok/toolhive,org.opencontainers.image.title="toolhive-vmcp",org.opencontainers.image.vendor=Stacklok
408+
409+ - name : Sign Image with Cosign
410+ # This step uses the identity token to provision an ephemeral certificate
411+ # against the sigstore community Fulcio instance.
412+ run : |
413+ TAG=$(echo "${{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
414+ # Sign the ko image
415+ cosign sign -y $BASE_REPO:$TAG
416+
339417 # Sign the latest tag if building from a tag
340418 if [[ "${{ github.ref }}" == refs/tags/* ]]; then
341419 cosign sign -y $BASE_REPO:latest
0 commit comments