This commit is contained in:
Xi Yan 2025-01-09 15:22:25 -08:00
parent 45cf46e62f
commit 20dc1860c6

View file

@ -1,9 +1,15 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI name: Publish Python 🐍 distribution 📦 to TestPyPI
on: on:
workflow_dispatch: # Keep manual trigger push
schedule: # workflow_dispatch: # Keep manual trigger
- cron: "0 0 * * *" # Run every day at midnight # 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: jobs:
build: build:
@ -17,14 +23,15 @@ jobs:
- name: Get date - name: Get date
id: date id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Get short SHA
id: sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Update version for nightly - name: Update version for nightly
if: github.event_name == 'schedule' # if: github.event_name == 'schedule'
run: | run: |
# Assuming your version is in setup.py or pyproject.toml # Assuming your version is in setup.py or pyproject.toml
sed -i 's/version="\([^"]*\)"/version="\1rc${{ steps.date.outputs.date }}"/' setup.py sed -i 's/version="\([^"]*\)"/version="\1.dev0000${{ steps.date.outputs.date }}"/' setup.py
- name: Update version for manual RC
if: github.event_name == 'workflow_dispatch'
run: |
sed -i 's/version="\([^"]*\)"/version="\1rc${{ inputs.rc_version }}"/' setup.py
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
@ -50,7 +57,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: environment:
name: testpypi name: testrelease
url: https://test.pypi.org/p/llama-stack url: https://test.pypi.org/p/llama-stack
permissions: permissions: