name: Publish Python 🐍 distribution 📦 to PyPI on: pull_request: push: branches: - main release: types: - published permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: name: Build distribution 📦 runs-on: ubuntu-latest steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: fetch-depth: 0 persist-credentials: false - name: Set up Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: "3.13" - name: Build sdist and wheel run: pipx run --spec build==1.5.0 pyproject-build --sdist --wheel --outdir dist - name: Check distributions working-directory: dist run: | ls -alh python -m pip install *.whl pipx run --spec twine==6.2.0 twine check * - name: Upload distributions 📦 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: dist path: dist/ publish: name: Publish Python 🐍 distribution 📦 to PyPI runs-on: ubuntu-latest if: github.event_name == 'release' needs: [build] permissions: id-token: write environment: name: pypi url: https://pypi.org/p/conda-package-streaming steps: - name: Retrieve distributions uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: dist path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 with: packages-dir: dist/ upload-release-assets: name: Upload release assets runs-on: ubuntu-latest if: github.event_name == 'release' needs: [publish] permissions: contents: write steps: - name: Retrieve distributions uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: dist path: dist/ - name: Upload assets to GitHub Release env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} TAG_NAME: ${{ github.event.release.tag_name }} run: gh release upload "$TAG_NAME" dist/* --repo "$GH_REPO"