Publish Package to PyPI #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Package to PyPI | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+*' | |
| schedule: | |
| - cron: '0 8 * * *' | |
| jobs: | |
| pypi_publish: | |
| name: Build and Publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if tag is on main branch | |
| if: github.event_name == 'push' | |
| run: | | |
| echo "Checking if tag ${{ github.ref_name }} is on main branch..." | |
| if git branch -r --contains ${{ github.ref_name }} | grep -q "origin/main"; then | |
| echo "Tag is on origin/main. Proceeding with release." | |
| else | |
| echo "ERROR Tag ${{ github.ref_name }} is not on origin/main." | |
| echo "This release will be aborted to prevent publishing from a non-main branch." | |
| exit 1 | |
| fi | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Determine Version | |
| id: vars | |
| env: | |
| GH_EVENT_NAME: ${{ github.event_name }} | |
| GH_REF_NAME: ${{ github.ref_name }} | |
| GH_REF: ${{ github.ref }} | |
| run: bash .github/scripts/determine_release_vars.sh | |
| - name: Install dependencies (build) | |
| run: | |
| python3 -m pip install build | |
| - name: Build package (sdist and wheel) | |
| env: | |
| VLLM_VERSION_OVERRIDE: ${{ steps.vars.outputs.VERSION }} | |
| run: python3 -m build | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| - name: Publish completed message | |
| run: echo "---Build and publish completed successfully.---" |