Workflow file for this run
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
| # Publish Python package to PyPI when a release is created. | |
| # Build includes console frontend (see scripts/wheel_build.sh). | |
| # Manual trigger: can optionally force push to PyPI or just upload artifacts. | |
| # Release trigger: publishes to PyPI. | |
| name: Publish Python Package to PyPI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| force_push_to_pypi: | |
| description: 'Force push to PyPI (even without release)' | |
| required: false | |
| type: boolean | |
| default: false | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Set up Node (for console build) | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: console/package-lock.json | |
| - name: Build console frontend | |
| run: | | |
| cd console && npm ci && npm run build | |
| - name: Copy console build into package | |
| run: | | |
| rm -rf src/qwenpaw/console/* | |
| mkdir -p src/qwenpaw/console | |
| cp -R console/dist/* src/qwenpaw/console/ | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools wheel build | |
| - name: Build package | |
| run: python -m build | |
| - name: Upload wheel to artifacts (manual trigger without force push) | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.force_push_to_pypi != 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: qwenpaw-wheel | |
| path: dist/*.whl | |
| retention-days: 30 | |
| - name: Publish package to PyPI | |
| if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.force_push_to_pypi == 'true') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} |