11name : Release Docker Images (NPU)
22on :
33 push :
4- branches :
5- - main
6- paths :
7- - " python/sglang/version.py"
8- pull_request :
9- branches :
10- - main
11- paths :
12- - " .github/workflows/release-docker-npu.yml"
13- - " docker/npu.Dockerfile"
4+ tags :
5+ - ' v[0-9]+.*'
146 workflow_dispatch :
7+ inputs :
8+ version :
9+ description : ' Version to build (without v prefix, e.g., 0.5.7)'
10+ required : true
1511
1612jobs :
1713 build :
@@ -51,11 +47,26 @@ jobs:
5147 username : ${{ secrets.DOCKERHUB_USERNAME }}
5248 password : ${{ secrets.DOCKERHUB_TOKEN }}
5349
54- - name : Get version
55- id : get_version
50+ - name : Get version from tag
51+ id : version
5652 run : |
57- version=$(cat python/sglang/version.py | cut -d'"' -f2)
58- echo "TAG=lmsysorg/sglang:v$version-cann${{ matrix.cann_version }}-${{ matrix.device_type }}" >> $GITHUB_OUTPUT
53+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
54+ VERSION="${{ github.event.inputs.version }}"
55+ else
56+ # Extract version from tag (e.g., v0.5.7 -> 0.5.7)
57+ VERSION="${GITHUB_REF_NAME#v}"
58+ fi
59+ # Validate version format
60+ if [ -z "$VERSION" ]; then
61+ echo "::error::Version is empty"
62+ exit 1
63+ fi
64+ if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+'; then
65+ echo "::error::Invalid version format: $VERSION (expected: X.Y.Z)"
66+ exit 1
67+ fi
68+ echo "version=v${VERSION}" >> $GITHUB_OUTPUT
69+ echo "TAG=lmsysorg/sglang:v${VERSION}-cann${{ matrix.cann_version }}-${{ matrix.device_type }}" >> $GITHUB_OUTPUT
5970
6071 - name : Build and push Docker image
6172 id : build-and-push
@@ -66,10 +77,11 @@ jobs:
6677 # TODO: need add x86 platforms support when memfabric is ready
6778 platforms : linux/arm64
6879 labels : ${{ steps.meta.outputs.labels }}
69- tags : ${{ steps.meta.outputs.tags || steps.get_version .outputs.TAG }}
80+ tags : ${{ steps.meta.outputs.tags || steps.version .outputs.TAG }}
7081 push : ${{ github.repository == 'sgl-project/sglang' && github.event_name != 'pull_request' }}
7182 provenance : false
7283 build-args : |
7384 SGLANG_KERNEL_NPU_TAG=20251206
7485 CANN_VERSION=${{ matrix.cann_version }}
7586 DEVICE_TYPE=${{ matrix.device_type }}
87+ SGLANG_TAG=${{ steps.version.outputs.version }}
0 commit comments