diff --git a/.github/workflows/release-docker-xeon.yml b/.github/workflows/release-docker-xeon.yml index 60e249335..cde5ad15e 100644 --- a/.github/workflows/release-docker-xeon.yml +++ b/.github/workflows/release-docker-xeon.yml @@ -1,11 +1,13 @@ name: Release Docker Xeon Images on: push: - branches: - - main - paths: - - "python/sglang/version.py" + tags: + - 'v[0-9]+.*' workflow_dispatch: + inputs: + version: + description: 'Version to build (without v prefix, e.g., 0.5.7)' + required: true jobs: publish: @@ -26,10 +28,35 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Get version from tag + id: version + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION="${{ github.event.inputs.version }}" + else + # Extract version from tag (e.g., v0.5.7 -> 0.5.7) + VERSION="${GITHUB_REF_NAME#v}" + fi + + # Validate version format + if [ -z "$VERSION" ]; then + echo "::error::Version is empty" + exit 1 + fi + if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+'; then + echo "::error::Invalid version format: $VERSION (expected: X.Y.Z)" + exit 1 + fi + + echo "version=${VERSION}" >> $GITHUB_OUTPUT + - name: Build and Push run: | - version=$(cat python/sglang/version.py | cut -d'"' -f2) + version=${{ steps.version.outputs.version }} tag=v${version}-xeon - docker build . -f docker/xeon.Dockerfile -t lmsysorg/sglang:${tag} --no-cache + docker build . -f docker/xeon.Dockerfile \ + --build-arg VER_SGLANG=v${version} \ + -t lmsysorg/sglang:${tag} \ + --no-cache docker push lmsysorg/sglang:${tag}