Skip to content

Build Release (CPU) #106

Build Release (CPU)

Build Release (CPU) #106

name: Build Release (CPU)
on: workflow_dispatch
permissions:
contents: write
jobs:
build_wheels:
name: wheels ${{ matrix.os }} and py-${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04] # windows-2025
python-version: ["3.13"]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
submodules: "recursive"
- name: Verify GLIBC version
run: ldd --version
- name: Install the latest version of uv
uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3 # v7
with:
version: "latest"
activate-environment: true
python-version: ${{ matrix.python-version }}
- name: Build source distribution
working-directory: ./vendor/llama-cpp-python
run: |
# Rename the release version with +cpu build tag
sed -i 's/__version__ = "\([^"]*\)"/__version__ = "\1+cpu"/' llama_cpp/__init__.py
# Build wheel
uv -v build --no-create-gitignore --python cpython@${{ matrix.python-version }} --wheel
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
with:
name: wheels-py${{ matrix.python-version }}-${{ matrix.os }}
path: ./vendor/llama-cpp-python/dist/*.whl
build_sdist:
name: Build Source Distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
submodules: "recursive"
- name: Install the latest version of uv
uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3 # v7
with:
version: "latest"
activate-environment: true
python-version: "3.12"
- name: Build source distribution
working-directory: ./vendor/llama-cpp-python
run: |
uv -v build --no-create-gitignore --sdist
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
with:
name: sdist
path: ./vendor/llama-cpp-python/dist/*.tar.gz
release:
name: Release
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
attestations: write
steps:
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
with:
merge-multiple: true
path: dist
- uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2
with:
files: dist/*
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3
with:
subject-path: 'dist/*'