Skip to content

Commit 5b75ee3

Browse files
authored
fix release versioning and publish tags (#1490)
Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai>
1 parent 3298fef commit 5b75ee3

File tree

15 files changed

+184
-23
lines changed

15 files changed

+184
-23
lines changed

.github/workflows/docker-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
packages: write
6262
strategy:
6363
matrix:
64-
image: [extproc, extproc-rocm, llm-katan, vllm-sr, vllm-sr-rocm]
64+
image: [dashboard, extproc, extproc-rocm, llm-katan, vllm-sr, vllm-sr-rocm]
6565
fail-fast: false
6666

6767
steps:
@@ -182,7 +182,7 @@ jobs:
182182
packages: write
183183
strategy:
184184
matrix:
185-
image: [extproc, llm-katan, vllm-sr]
185+
image: [dashboard, extproc, llm-katan, vllm-sr]
186186
platform: [linux/amd64, linux/arm64]
187187
fail-fast: false
188188

@@ -548,7 +548,7 @@ jobs:
548548
packages: write
549549
strategy:
550550
matrix:
551-
image: [extproc, llm-katan, vllm-sr]
551+
image: [dashboard, extproc, llm-katan, vllm-sr]
552552
fail-fast: false
553553

554554
steps:

.github/workflows/docker-release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,48 @@ jobs:
5252
ghcr.io/${{ env.REPOSITORY_OWNER_LOWER }}/semantic-router/extproc:${{ steps.extract_tag.outputs.tag }}
5353
ghcr.io/${{ env.REPOSITORY_OWNER_LOWER }}/semantic-router/extproc:latest
5454
55+
build_and_push_vllm_sr:
56+
if: github.repository == 'vllm-project/semantic-router'
57+
runs-on: ubuntu-latest
58+
permissions:
59+
contents: read
60+
packages: write
61+
62+
steps:
63+
- name: Check out the repo
64+
uses: actions/checkout@v4
65+
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v3
68+
69+
- name: Set up QEMU
70+
uses: docker/setup-qemu-action@v3
71+
72+
- name: Extract tag name
73+
id: extract_tag
74+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
75+
76+
- name: Set lowercase repository owner
77+
run: echo "REPOSITORY_OWNER_LOWER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
78+
79+
- name: Log in to GitHub Container Registry
80+
uses: docker/login-action@v3
81+
with:
82+
registry: ghcr.io
83+
username: ${{ github.actor }}
84+
password: ${{ secrets.GITHUB_TOKEN }}
85+
86+
- name: Build and push vllm-sr Docker image
87+
uses: docker/build-push-action@v5
88+
with:
89+
context: .
90+
file: ./src/vllm-sr/Dockerfile
91+
platforms: linux/amd64,linux/arm64
92+
push: true
93+
tags: |
94+
ghcr.io/${{ env.REPOSITORY_OWNER_LOWER }}/semantic-router/vllm-sr:${{ steps.extract_tag.outputs.tag }}
95+
ghcr.io/${{ env.REPOSITORY_OWNER_LOWER }}/semantic-router/vllm-sr:latest
96+
5597
build_and_push_extproc_rocm:
5698
if: github.repository == 'vllm-project/semantic-router'
5799
runs-on: ubuntu-latest

.github/workflows/helm-publish.yml

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ on:
77
- main
88
paths:
99
- "deploy/helm/**"
10+
- ".github/workflows/helm-publish.yml"
1011
push:
1112
branches:
1213
- main
14+
tags:
15+
- "v*"
1316
paths:
1417
- "deploy/helm/**"
18+
- ".github/workflows/helm-publish.yml"
1519
workflow_dispatch:
1620

1721
env:
@@ -29,6 +33,8 @@ jobs:
2933
contents: read
3034
outputs:
3135
chart-name: ${{ steps.package.outputs.name }}
36+
chart-version: ${{ steps.versions.outputs.chart_version }}
37+
chart-app-version: ${{ steps.versions.outputs.app_version }}
3238
steps:
3339
- uses: actions/checkout@v4
3440
- uses: azure/setup-helm@v4
@@ -38,20 +44,55 @@ jobs:
3844
- name: Lint chart
3945
run: helm lint ${{ env.CHART_PATH }}
4046

47+
- name: Resolve chart versions
48+
id: versions
49+
run: |
50+
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
51+
echo "chart_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
52+
echo "app_version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
53+
elif [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
54+
echo "chart_version=0.0.0-pr.${{ github.event.number }}" >> $GITHUB_OUTPUT
55+
echo "app_version=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT
56+
else
57+
echo "chart_version=0.0.0-latest" >> $GITHUB_OUTPUT
58+
echo "app_version=latest" >> $GITHUB_OUTPUT
59+
fi
60+
4161
- name: Package chart
4262
id: package
4363
run: |
44-
helm package -u ${{ env.CHART_PATH }} --version v0.0.0-latest --destination .
64+
helm package -u ${{ env.CHART_PATH }} \
65+
--version "${{ steps.versions.outputs.chart_version }}" \
66+
--app-version "${{ steps.versions.outputs.app_version }}" \
67+
--destination .
4568
echo "name=$(ls *.tgz)" >> $GITHUB_OUTPUT
4669
4770
- name: Upload packaged chart
48-
if: github.event_name != 'pull_request'
4971
uses: actions/upload-artifact@v4
5072
with:
5173
name: helm-chart
5274
path: "*.tgz"
5375
retention-days: 1
5476

77+
- name: Create package summary
78+
run: |
79+
cat >> $GITHUB_STEP_SUMMARY << EOF
80+
## Helm Chart Package
81+
82+
- Chart: \`${{ env.CHART_NAME }}\`
83+
- Version: \`${{ steps.versions.outputs.chart_version }}\`
84+
- App Version: \`${{ steps.versions.outputs.app_version }}\`
85+
- Package: \`${{ steps.package.outputs.name }}\`
86+
- Event: \`${{ github.event_name }}\`
87+
EOF
88+
89+
if [ "${{ github.event_name }}" = "pull_request" ]; then
90+
cat >> $GITHUB_STEP_SUMMARY << EOF
91+
92+
This PR run uploads the packaged chart as the \`helm-chart\` workflow artifact.
93+
EOF
94+
fi
95+
5596
publish-chart:
5697
name: Publish to GHCR
5798
runs-on: ubuntu-latest
@@ -83,18 +124,19 @@ jobs:
83124
## 📦 Helm Chart Published
84125
85126
**Chart:** \`${{ env.CHART_NAME }}\`
86-
**Version:** \`v0.0.0-latest\`
127+
**Version:** \`${{ needs.validate-and-package.outputs.chart-version }}\`
128+
**App Version:** \`${{ needs.validate-and-package.outputs.chart-app-version }}\`
87129
**Registry:** \`${{ env.REGISTRY }}/$REPOSITORY_OWNER_LOWER/charts\`
88130
89131
### Installation
90132
91133
\`\`\`bash
92134
# Pull the chart
93-
helm pull oci://${{ env.REGISTRY }}/$REPOSITORY_OWNER_LOWER/charts/${{ env.CHART_NAME }} --version v0.0.0-latest
135+
helm pull oci://${{ env.REGISTRY }}/$REPOSITORY_OWNER_LOWER/charts/${{ env.CHART_NAME }} --version ${{ needs.validate-and-package.outputs.chart-version }}
94136
95137
# Install directly
96138
helm install semantic-router oci://${{ env.REGISTRY }}/$REPOSITORY_OWNER_LOWER/charts/${{ env.CHART_NAME }} \\
97-
--version v0.0.0-latest \\
139+
--version ${{ needs.validate-and-package.outputs.chart-version }} \\
98140
--namespace vllm-semantic-router-system \\
99141
--create-namespace
100142
\`\`\`
@@ -103,7 +145,7 @@ jobs:
103145
104146
\`\`\`bash
105147
helm upgrade semantic-router oci://${{ env.REGISTRY }}/$REPOSITORY_OWNER_LOWER/charts/${{ env.CHART_NAME }} \\
106-
--version v0.0.0-latest \\
148+
--version ${{ needs.validate-and-package.outputs.chart-version }} \\
107149
--namespace vllm-semantic-router-system
108150
\`\`\`
109151
EOF

.github/workflows/operator-ci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches:
66
- main
77
- develop
8+
tags:
9+
- 'v*'
810
paths:
911
- 'deploy/operator/**'
1012
- '.github/workflows/operator-ci.yml'
@@ -154,15 +156,23 @@ jobs:
154156
id: operator-remote-tags
155157
if: github.event_name != 'pull_request'
156158
run: |
157-
TAG="${{ github.sha }}"
159+
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
160+
TAG="${GITHUB_REF#refs/tags/}"
161+
else
162+
TAG="${{ github.sha }}"
163+
fi
158164
TAGS="ghcr.io/${REPOSITORY_OWNER_LOWER}/semantic-router/operator:${TAG},ghcr.io/${REPOSITORY_OWNER_LOWER}/semantic-router/operator:latest"
159165
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
160166
161167
- name: Generate remote tags for bundle
162168
id: bundle-remote-tags
163169
if: github.event_name != 'pull_request'
164170
run: |
165-
TAG="${{ github.sha }}"
171+
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
172+
TAG="${GITHUB_REF#refs/tags/}"
173+
else
174+
TAG="${{ github.sha }}"
175+
fi
166176
TAGS="ghcr.io/${REPOSITORY_OWNER_LOWER}/semantic-router/operator-bundle:${TAG},ghcr.io/${REPOSITORY_OWNER_LOWER}/semantic-router/operator-bundle:latest"
167177
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
168178

candle-binding/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

candle-binding/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "candle-semantic-router"
3-
version = "0.4.0"
3+
version = "0.2.0"
44
edition = "2021"
55
description = "Go bindings for Candle BERT semantic similarity model for LLM routing"
66
license = "MIT OR Apache-2.0"

deploy/helm/semantic-router/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: semantic-router
33
description: A Helm chart for deploying Semantic Router - an intelligent routing system for LLM applications
44
type: application
5-
version: 0.1.0
5+
version: 0.2.0
66
appVersion: "latest"
77
keywords:
88
- semantic-router

deploy/helm/semantic-router/templates/configmap.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{{- $observability := (get $config "observability") | default (dict) -}}
55
{{- $tracing := (get $observability "tracing") | default (dict) -}}
66
{{- $tracingExporter := (get $tracing "exporter") | default (dict) -}}
7+
{{- $tracingResource := (get $tracing "resource") | default (dict) -}}
78
{{- $semanticBackend := (get $semanticCache "backend_type") | default "" -}}
89
{{- $responseBackend := (get $responseAPI "store_backend") | default "" -}}
910
{{- $responseEnabled := (get $responseAPI "enabled") | default false -}}
@@ -28,9 +29,16 @@
2829
{{- if and $tracingEnabled .Values.dependencies.observability.jaeger.enabled -}}
2930
{{- $_ := set $tracingExporter "endpoint" (include "semantic-router.jaeger.otlpEndpoint" .) -}}
3031
{{- $_ := set $tracing "exporter" $tracingExporter -}}
31-
{{- $_ := set $observability "tracing" $tracing -}}
3232
{{- end -}}
3333

34+
{{- if and (gt (len $tracingResource) 0) .Chart.AppVersion (eq ((get $tracingResource "service_version") | default "") "") -}}
35+
{{- $_ := set $tracingResource "service_version" .Chart.AppVersion -}}
36+
{{- end -}}
37+
{{- if gt (len $tracingResource) 0 -}}
38+
{{- $_ := set $tracing "resource" $tracingResource -}}
39+
{{- end -}}
40+
{{- $_ := set $observability "tracing" $tracing -}}
41+
3442
{{- $_ := set $config "semantic_cache" $semanticCache -}}
3543
{{- $_ := set $config "response_api" $responseAPI -}}
3644
{{- $_ := set $config "observability" $observability -}}

deploy/helm/semantic-router/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ image:
1919
# -- Image pull policy
2020
pullPolicy: IfNotPresent
2121
# -- Image tag (overrides the image tag whose default is the chart appVersion)
22-
tag: "latest"
22+
tag: ""
2323

2424
# -- Image pull secrets for private registries
2525
imagePullSecrets: []
@@ -326,7 +326,7 @@ config:
326326
rate: 1.0
327327
resource:
328328
service_name: "vllm-semantic-router"
329-
service_version: "v0.1.0"
329+
service_version: ""
330330
deployment_environment: "development"
331331

332332
# Tools database configuration

src/vllm-sr/cli/__init__.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
11
"""vLLM Semantic Router CLI package."""
22

3-
__version__ = "0.1.0"
3+
from __future__ import annotations
4+
5+
import re
6+
from importlib.metadata import PackageNotFoundError, version
7+
from pathlib import Path
8+
9+
_PYPROJECT_VERSION_PATTERN = re.compile(
10+
r'^version = "(?P<version>[^"]+)"$', re.MULTILINE
11+
)
12+
13+
14+
def _load_version() -> str:
15+
pyproject_path = Path(__file__).resolve().parents[1] / "pyproject.toml"
16+
try:
17+
match = _PYPROJECT_VERSION_PATTERN.search(
18+
pyproject_path.read_text(encoding="utf-8")
19+
)
20+
except FileNotFoundError:
21+
match = None
22+
if match is not None:
23+
return match.group("version")
24+
25+
try:
26+
return version("vllm-sr")
27+
except PackageNotFoundError:
28+
return "unknown"
29+
30+
31+
__version__ = _load_version()

0 commit comments

Comments
 (0)