name: Release Docker Images (AMD) on: push: tags: - 'v[0-9]+.*' workflow_dispatch: inputs: version: description: 'Version to build (without v prefix, e.g., 0.5.7)' required: true rocm_version: description: 'ROCm version to build' required: false type: choice default: 'all' options: - 'all' - rocm724 - rocm720 - rocm700 jobs: publish: if: github.repository == 'sgl-project/sglang' runs-on: amd-docker-scale environment: 'prod' strategy: # Six flavors publish independently: a failure in one must not cancel the # others mid-push and leave the release tag with a partial image set. fail-fast: false matrix: rocm_version: ${{ fromJson((github.event_name == 'workflow_dispatch' && inputs.rocm_version != 'all' && inputs.rocm_version != '') && format('["{0}"]', inputs.rocm_version) || '["rocm700", "rocm720", "rocm724"]') }} gpu_arch: ['gfx942', 'gfx950'] build_type: ['all'] steps: - name: Checkout repository uses: actions/checkout@v4 - name: Login to Docker Hub uses: docker/login-action@v2 with: 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=${{ steps.version.outputs.version }} echo "Version: ${version}" gpu_arch_suffix="" if [ "${{ matrix.rocm_version }}" = "rocm700" ]; then if [ "${{ matrix.gpu_arch }}" = "gfx942" ]; then rocm_tag="rocm700-mi30x" elif [ "${{ matrix.gpu_arch }}" = "gfx950" ]; then rocm_tag="rocm700-mi35x" else echo "Unsupported gfx arch" exit 1 fi elif [ "${{ matrix.rocm_version }}" = "rocm720" ] || [ "${{ matrix.rocm_version }}" = "rocm724" ]; then gpu_arch_suffix="-${{ matrix.rocm_version }}" if [ "${{ matrix.gpu_arch }}" = "gfx942" ]; then rocm_tag="${{ matrix.rocm_version }}-mi30x" elif [ "${{ matrix.gpu_arch }}" = "gfx950" ]; then rocm_tag="${{ matrix.rocm_version }}-mi35x" else echo "Unsupported gfx arch" exit 1 fi else echo "Unsupported rocm version" exit 1 fi tag=v${version}-${rocm_tag} # rocm.Dockerfile expects SGL_BRANCH with 'v' prefix for git tag checkout # remove --build-arg NIC_BACKEND=ainic for auto detection nic support in mori # UBUNTU_MIRROR forces apt over HTTPS to dodge port-80 reachability flakes # to Canonical's archive.ubuntu.com mirror IPs from the amd-docker-scale runner. docker build . -f docker/rocm.Dockerfile --build-arg BUILD_TYPE=${{ matrix.build_type }} --build-arg GPU_ARCH=${{ matrix.gpu_arch }}${gpu_arch_suffix} --build-arg SGL_BRANCH=v${version} --build-arg ENABLE_MORI=1 --build-arg UBUNTU_MIRROR=https://archive.ubuntu.com -t lmsysorg/sglang:${tag} --no-cache docker push lmsysorg/sglang:${tag}