Skip to content

Commit b69c2a5

Browse files
authored
Merge pull request #10 from kagent-dev/release-workflow
add release workflow
2 parents e113179 + 184ab2a commit b69c2a5

3 files changed

Lines changed: 87 additions & 1 deletion

File tree

.github/workflows/tag.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Tag and Push
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version number'
11+
12+
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#release
13+
# GITHUB_SHA = Last commit in the tagged release
14+
# GITHUB_REF = Tag ref of release refs/tags/<tag_name>
15+
jobs:
16+
push-images:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
steps:
22+
- name: 'Checkout GitHub Action'
23+
uses: actions/checkout@main
24+
25+
- name: Login to GitHub Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
37+
- name: 'Build Images'
38+
env:
39+
DOCKER_BUILD_ARGS: "--push --platform linux/amd64,linux/arm64"
40+
run: |
41+
# if workflow_dispatch is used, use the version input
42+
if [ -n "${{ github.event.inputs.version }}" ]; then
43+
export VERSION=${{ github.event.inputs.version }}
44+
else
45+
export VERSION=$(echo "$GITHUB_REF" | cut -c12-)
46+
fi
47+
make build-mcp
48+
49+
release:
50+
# Only run release after images and helm chart are pushed
51+
# In the future we can take the chart from the helm action,
52+
# and build the CLI beforehand.
53+
needs:
54+
- push-images
55+
runs-on: ubuntu-latest
56+
permissions:
57+
contents: write
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
- name: Release
62+
uses: softprops/action-gh-release@v2
63+
if: startsWith(github.ref, 'refs/tags/')

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Image configuration
2+
DOCKER_REGISTRY ?= ghcr.io
3+
BASE_IMAGE_REGISTRY ?= cgr.dev
4+
DOCKER_REPO ?= kagent-dev/doc2vec
5+
6+
BUILD_DATE := $(shell date -u '+%Y-%m-%d')
7+
GIT_COMMIT := $(shell git rev-parse --short HEAD || echo "unknown")
8+
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null | sed 's/-dirty//' | grep v || echo "v0.0.0-$(GIT_COMMIT)")
9+
10+
MCP_IMAGE_NAME ?= mcp
11+
12+
# Local architecture detection to build for the current platform
13+
LOCALARCH ?= $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
14+
15+
DOCKER_BUILDER ?= docker buildx
16+
DOCKER_BUILD_ARGS ?= --progress=plain --builder $(BUILDX_BUILDER_NAME) --pull --load --platform linux/$(LOCALARCH)
17+
18+
BUILDX_NO_DEFAULT_ATTESTATIONS=1
19+
BUILDX_BUILDER_NAME=kagent-builder
20+
21+
# Build the MCP image
22+
build-mcp:
23+
$(DOCKER_BUILDER) build $(DOCKER_BUILD_ARGS) -t $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(MCP_IMAGE_NAME):$(VERSION) -t $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(MCP_IMAGE_NAME):latest -f mcp/Dockerfile ./mcp

mcp/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ COPY --from=builder --chown=kagent:nodejs /app/package.json ./
6161

6262
USER kagent
6363

64-
LABEL org.opencontainers.image.source=https://github.com/kagent-dev/kagent-doc2vec
64+
LABEL org.opencontainers.image.source=https://github.com/kagent-dev/doc2vec
6565
LABEL org.opencontainers.image.description="Kagent Doc2Vec MCP"
6666
LABEL org.opencontainers.image.authors="Kagent Creators 🤖"
6767

0 commit comments

Comments
 (0)