diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 31032cff..4d220272 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -16,7 +16,7 @@ on: default: '' concurrency: - group: build-${{ github.ref }} + group: build-${{ github.ref }}-${{ github.event.inputs.branch_to_build }} cancel-in-progress: true jobs: @@ -31,10 +31,23 @@ jobs: env: CMAKE_BUILD_PARALLEL_LEVEL: '4' steps: + - name: Determine target branch + id: branch + run: | + NAME="${{ github.event.inputs.branch_to_build }}" + if [ -z "$NAME" ]; then + NAME="${{ github.ref_name }}" + fi + # Sanitize for artifact naming (replace / with -) + SAFE_NAME=$(echo "$NAME" | tr '/' '-') + echo "name=$NAME" >> $GITHUB_OUTPUT + echo "safe_name=$SAFE_NAME" >> $GITHUB_OUTPUT + echo "Target branch: $NAME (safe: $SAFE_NAME)" + - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ github.event.inputs.branch_to_build || github.ref }} + ref: ${{ steps.branch.outputs.name }} submodules: recursive - name: Set up Python ${{ matrix.python }} @@ -67,7 +80,7 @@ jobs: - name: Upload wheel artifact uses: actions/upload-artifact@v4 with: - name: mlx-${{ github.ref_name }}-py${{ matrix.python }}-wheels + name: mlx-${{ steps.branch.outputs.safe_name }}-py${{ matrix.python }}-wheels path: ./wheels/*.whl retention-days: 30 if-no-files-found: error