1# This workflow will upload a Python Package using Twine when a GGUF release is created
 2# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
 3
 4# See `gguf-py/README.md` for how to make a release.
 5
 6# This workflow uses actions that are not certified by GitHub.
 7# They are provided by a third-party and are governed by
 8# separate terms of service, privacy policy, and support
 9# documentation.
10
11name: Upload Python Package
12
13on:
14  workflow_dispatch:
15  push:
16    # Pattern matched against refs/tags
17    tags:
18      - 'gguf-v*'           # Push events to every version tag
19
20
21jobs:
22  deploy:
23
24    runs-on: ubuntu-slim
25
26    steps:
27    - uses: actions/checkout@v6
28    - name: Set up Python
29      uses: actions/setup-python@v6
30      with:
31        python-version: '3.9.x'
32    - name: Install dependencies
33      run: |
34        cd gguf-py
35        python -m pip install poetry
36        poetry install
37
38    - name: Build package
39      run: cd gguf-py && poetry build
40    - name: Publish package
41      uses: pypa/gh-action-pypi-publish@release/v1
42      with:
43        password: ${{ secrets.PYPI_API_TOKEN }}
44        packages-dir: gguf-py/dist