Skip to content

Commit

Permalink
[CICD] llama-stack-client nightly package github workflow (#80)
Browse files Browse the repository at this point in the history
# What does this PR do?

- as title
-
https://test.pypi.org/manage/project/llama-stack-client/settings/publishing/

## Test Plan
<img width="1674" alt="image"
src="https://github.com/user-attachments/assets/be015387-1a40-433e-8ef1-af2444734646"
/>

**Checking that the uploaded package have set version correctly**
<img width="640" alt="image"
src="https://github.com/user-attachments/assets/67991a51-0941-477a-b653-106fbcbb1450"
/>


## Sources

Please link relevant resources if necessary.


## Before submitting

- [ ] This PR fixes a typo or improves the docs (you can dismiss the
other checks if that's the case).
- [ ] Ran pre-commit to handle lint / formatting issues.
- [ ] Read the [contributor
guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md),
      Pull Request section?
- [ ] Updated relevant documentation.
- [ ] Wrote necessary unit or integration tests.
  • Loading branch information
yanxi0830 authored Jan 9, 2025
1 parent c8bdeb5 commit f6b2a31
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
76 changes: 76 additions & 0 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Publish Python 🐍 distribution 📦 to TestPyPI

on:
workflow_dispatch: # Keep manual trigger
inputs:
rc_version:
description: 'RC version number (e.g., 1, 2, 3)'
required: true
type: string
schedule:
- cron: "0 0 * * *" # Run every day at midnight

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 nightly
if: github.event_name == 'schedule'
run: |
# Version is in pyproject.toml
sed -i 's/version = "\([^"]*\)"/version = "\1.dev${{ steps.date.outputs.date }}"/' pyproject.toml
sed -i 's/__version__ = "\([^"]*\)"/__version__ = "\1.dev${{ steps.date.outputs.date }}"/' src/llama_stack_client/_version.py
- name: Update version for manual RC
if: github.event_name == 'workflow_dispatch'
run: |
sed -i 's/version = "\([^"]*\)"/version = "\1rc${{ inputs.rc_version }}"/' pyproject.toml
sed -i 's/__version__ = "\([^"]*\)"/__version__ = "\1rc${{ inputs.rc_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/
2 changes: 1 addition & 1 deletion src/llama_stack_client/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "llama_stack_client"
__version__ = "0.0.1-alpha.0"
__version__ = "0.0.63"

0 comments on commit f6b2a31

Please sign in to comment.