diff --git a/.github/workflows/build-wheels-metal.yaml b/.github/workflows/build-wheels-metal.yaml index abb8969247..98ed59f1ff 100644 --- a/.github/workflows/build-wheels-metal.yaml +++ b/.github/workflows/build-wheels-metal.yaml @@ -1,7 +1,10 @@ name: Build Wheels (Metal) on: - workflow_dispatch + workflow_dispatch: + push: + tags: + - "v*" permissions: contents: write @@ -25,7 +28,7 @@ jobs: with: python-version: "3.13" cache: 'pip' - + - name: Install dependencies (MacOS) run: | python -m pip install --upgrade pip @@ -46,7 +49,7 @@ jobs: env: CIBW_REPAIR_WHEEL_COMMAND: "" CIBW_ARCHS: "arm64" - CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*" + CIBW_BUILD: "cp312-* cp313-*" CIBW_ENVIRONMENT: > CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 @@ -57,13 +60,13 @@ jobs: -DGGML_METAL_SHADER_DEBUG=on" with: package-dir: . - output-dir: wheelhouse2 + output-dir: wheelhouse - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: wheels-metal_${{ matrix.os }} - path: ./wheelhouse2/*.whl + name: wheels-metal-macos + path: ./wheelhouse/*.whl release: name: Release @@ -75,20 +78,17 @@ jobs: uses: actions/download-artifact@v4 with: merge-multiple: true - path: dist2 + path: dist - - name: Get Current Date # Step to get current date for the release tag - id: get-date - run: | - # Get date in YYYYMMDD format using bash date command - currentDate=$(date +%Y%m%d) - # Store the date in environment variable for the release step - echo "BUILD_DATE=$currentDate" >> $GITHUB_ENV + - name: List wheels + run: ls -la dist/ - name: Publish Release uses: softprops/action-gh-release@v2.2.2 with: - files: dist2/* - tag_name: v${{ needs.build_wheels.outputs.version }}-Metal-macos-${{ env.BUILD_DATE }} + files: dist/* + tag_name: v${{ needs.build_wheels.outputs.version }}-metal + name: "v${{ needs.build_wheels.outputs.version }} (Metal/macOS arm64)" + generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/simple-index.yaml b/.github/workflows/simple-index.yaml new file mode 100644 index 0000000000..9a3bea97da --- /dev/null +++ b/.github/workflows/simple-index.yaml @@ -0,0 +1,88 @@ +name: Publish PEP 503 Simple Index + +# Regenerates a PEP 503 simple index from every release's .whl assets and +# publishes it to GitHub Pages so `uv` / `pip` can resolve wheels directly +# from this fork via `--extra-index-url https://cosmasense.github.io/llama-cpp-python/simple/`. +# +# Triggers: release events (any wheel add/remove) and manual dispatch. + +on: + release: + types: [published, edited, deleted, released, unpublished] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +# One deploy at a time; don't cancel an in-flight publish, just queue. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Generate simple index + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + run: | + set -euo pipefail + mkdir -p public/simple/llama-cpp-python + + # Per-package index (PEP 503). One per wheel asset across all + # releases, pointing at the asset's browser_download_url so pip/uv + # can GET it without any further auth. + { + echo '' + echo 'llama-cpp-python' + echo "

llama-cpp-python

" + gh api --paginate "repos/$REPO/releases" \ + --jq '.[].assets[] | select(.name | endswith(".whl")) | "
" + .name + "
"' + echo '' + } > public/simple/llama-cpp-python/index.html + + # Root index lists the packages served by this host. With one + # package today, this is just a pointer to the dir above. + { + echo '' + echo 'Simple Index' + echo 'llama-cpp-python
' + echo '' + } > public/simple/index.html + + # A courtesy landing page at the site root so anyone navigating to + # cosmasense.github.io/llama-cpp-python sees what this is. + { + echo '' + echo '' + echo '

cosmasense/llama-cpp-python wheel index

' + echo '

PEP 503 simple index: simple/

' + echo '
uv pip install --extra-index-url https://cosmasense.github.io/llama-cpp-python/simple/ llama-cpp-python
' + echo '' + } > public/index.html + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./public + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4