Publish PyPI #16
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 PyPI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Git tag to publish (e.g. v0.1.0-alpha.5)" | |
| required: true | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: refs/tags/${{ inputs.tag }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install twine | |
| run: pip install "twine>=6,<7" | |
| - name: Download Python artifacts from GitHub release | |
| run: | | |
| mkdir -p dist | |
| gh release download "${{ inputs.tag }}" \ | |
| --pattern 'quicknode_sdk-*.whl' \ | |
| --dir dist | |
| gh release download "${{ inputs.tag }}" \ | |
| --pattern 'quicknode_sdk-*.tar.gz' \ | |
| --dir dist | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Verify required wheels + sdist are present | |
| run: | | |
| wheel_count=$(ls dist/quicknode_sdk-*.whl 2>/dev/null | wc -l) | |
| sdist_count=$(ls dist/quicknode_sdk-*.tar.gz 2>/dev/null | wc -l) | |
| echo "Found $wheel_count wheels and $sdist_count sdist(s)" | |
| if [ "$wheel_count" -ne 20 ]; then | |
| echo "Expected 20 wheels (4 python versions × 5 OS targets), got $wheel_count" | |
| ls -la dist/ | |
| exit 1 | |
| fi | |
| if [ "$sdist_count" -ne 1 ]; then | |
| echo "Expected 1 sdist, got $sdist_count" | |
| ls -la dist/ | |
| exit 1 | |
| fi | |
| - name: Check distributions with twine | |
| run: twine check dist/* | |
| - name: Publish to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: twine upload --non-interactive --verbose dist/* |