test publish wheel to TestPypi #7
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: Build and Publish Wheels to PyPI | |
| on: | |
| push: | |
| # 1. Trigger the workflow on a specific branch for testing (recommended) | |
| # Change 'test-pypi-publish' to the branch you are using. | |
| branches: | |
| - 'vllm/ernie_build_wheel' | |
| # 2. Uncomment the 'tags' section when you are ready to publish final versions to PyPI | |
| # tags: | |
| # - 'v[0-9]+.[0-9]+.[0-9]+*' | |
| jobs: | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 45 | |
| strategy: | |
| matrix: | |
| # Define the operating systems for which to build wheels | |
| os: [ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Install cibuildwheel | |
| - name: Install cibuildwheel | |
| run: pip install cibuildwheel | |
| # Build the wheels for all Python versions supported by the OS | |
| - name: Build wheels | |
| env: | |
| # This tells cibuildwheel to only build for CPython 3.12 ('cp312') | |
| CIBW_BUILD: "cp312-*" | |
| # --output-dir specifies where cibuildwheel saves the wheels | |
| run: cibuildwheel --output-dir wheelhouse | |
| # Upload the built wheels as an artifact so the 'publish' job can access them | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: ./wheelhouse/*.whl | |
| publish: | |
| name: Publish to Test PyPI | |
| runs-on: ubuntu-latest | |
| # This job only runs after all build_wheels jobs are successful | |
| needs: [build_wheels] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Download all the wheels (artifacts) generated by the build_wheels jobs | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| path: dist # Download all wheels into the 'dist' folder | |
| # Securely upload all files in 'dist' to the PyPI repository | |
| - name: Publish package | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| # Use the secret token you created for Test PyPI (see instructions) | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| user: __token__ | |
| packages_dir: dist/wheels-ubuntu-latest/ | |
| # Publish to Test PyPI for safety during testing | |
| repository_url: https://test.pypi.org/legacy/ |