Skip to content

build-client-package #42

build-client-package

build-client-package #42

name: Publish Python 🐍 distribution πŸ“¦ to TestPyPI
on:
repository_dispatch: # on trigger from llama-stack
types: [build-client-package]
workflow_dispatch: # Keep manual trigger
inputs:
version:
description: 'Version number (e.g. 0.0.63.dev20250111)'
required: true
type: string
jobs:
build:
name: Build distribution πŸ“¦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Get date
id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Update version for manual RC
if: github.event_name == 'workflow_dispatch'
run: |
sed -i 's/version = "\([^"]*\)"/version = "${{ inputs.version }}"/' pyproject.toml
sed -i 's/__version__ = "\([^"]*\)"/__version__ = "${{ inputs.version }}"/' src/llama_stack_client/_version.py
- name: Update version for repository_dispatch
if: github.event_name == 'repository_dispatch' && github.event.client_payload.source == 'llama-stack-nightly'
run: |
sed -i 's/version = "\([^"]*\)"/version = "${{ github.event.client_payload.version }}"/' pyproject.toml
sed -i 's/__version__ = "\([^"]*\)"/__version__ = "${{ github.event.client_payload.version }}"/' src/llama_stack_client/_version.py
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-testpypi:
name: Publish Python 🐍 distribution πŸ“¦ to TestPyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: testrelease
url: https://test.pypi.org/p/llama-stack-client
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution πŸ“¦ to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/