initial test

This commit is contained in:
Xi Yan 2025-01-09 16:15:37 -08:00
parent 8527b79bfd
commit 620250324c

View file

@ -1,19 +1,45 @@
name: Publish Python 🐍 distribution 📦 to TestPyPI name: Publish Python 🐍 distribution 📦 to TestPyPI
on: on:
push workflow_dispatch: # Keep manual trigger
# workflow_dispatch: # Keep manual trigger inputs:
# inputs: rc_version:
# rc_version: description: 'RC version number (e.g., 1, 2, 3)'
# description: 'RC version number (e.g., 1, 2, 3)' required: true
# required: true type: string
# type: string schedule:
# schedule: - cron: "0 0 * * *" # Run every day at midnight
# - cron: "0 0 * * *" # Run every day at midnight
jobs: jobs:
trigger-client-build:
name: Trigger llama-stack-client build
runs-on: ubuntu-latest
steps:
- name: Get date
id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Compute version based on dispatch event
id: version
run: |
# Read base version from pyproject.toml
if [ "${{ github.event_name }}" = "schedule" ]; then
echo "version=.dev${{ steps.date.outputs.date }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=rc${{ inputs.rc_version }}" >> $GITHUB_OUTPUT
else
echo "version=.dev0" >> $GITHUB_OUTPUT
fi
- name: Trigger llama-stack-client workflow
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PAT_TOKEN }} # Personal Access Token with repo access
repository: meta-llama/llama-stack-client # Replace with actual repository path
event-type: build-client-package
client-payload: '{"source": "llama-stack-nightly", "version": "${{ steps.version.outputs.version }}"}'
build: build:
name: Build distribution 📦 name: Build distribution 📦
needs: trigger-client-build # Wait for client build to complete
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -23,15 +49,20 @@ 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: Compute version based on dispatch event
id: version
run: |
# Read base version from pyproject.toml
if [ "${{ github.event_name }}" = "schedule" ]; then
echo "version=.dev${{ steps.date.outputs.date }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=rc${{ inputs.rc_version }}" >> $GITHUB_OUTPUT
else
echo "version=.dev0" >> $GITHUB_OUTPUT
fi
- name: Update version for nightly - name: Update version for nightly
# if: github.event_name == 'schedule'
run: | run: |
# Assuming your version is in setup.py or pyproject.toml sed -i 's/version="\([^"]*\)"/version="\1${{ steps.version.outputs.version }}"/' setup.py
sed -i 's/version="\([^"]*\)"/version="\1.dev1234${{ 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: