From 620250324cd04da706474099187d05690b85749c Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 16:15:37 -0800 Subject: [PATCH] initial test --- .github/workflows/publish-to-test-pypi.yml | 63 ++++++++++++++++------ 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 515df7729..6b63bf8e2 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -1,19 +1,45 @@ name: Publish Python 🐍 distribution 📦 to TestPyPI on: - push - # 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 + 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: + 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: name: Build distribution 📦 + needs: trigger-client-build # Wait for client build to complete runs-on: ubuntu-latest steps: @@ -23,15 +49,20 @@ jobs: - 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: Update version for nightly - # if: github.event_name == 'schedule' run: | - # Assuming your version is in setup.py or pyproject.toml - 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 + sed -i 's/version="\([^"]*\)"/version="\1${{ steps.version.outputs.version }}"/' setup.py - name: Set up Python uses: actions/setup-python@v5 with: