Skip to content

Commit

Permalink
Add workflow to publish tagged releases to PyPI (#1369)
Browse files Browse the repository at this point in the history
* CI/CD: Add step to publish wheels on tag creation

* Remove file

* Restrict pre-release workflow branches

* Update PyPI publishing

* Update PyPI publishing

* Update package workflow name

* continuous pre-release only on main
  • Loading branch information
matthewdouglas authored Sep 24, 2024
1 parent e7c6fc6 commit bdf381c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
release:
types: [published]
workflow_dispatch: {} # Allow manual trigger
workflow_call: {} # Allow triggering from other worfkflows

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -156,6 +157,7 @@ jobs:
upload-pre-release-wheels:
name: Create release and upload artifacts
runs-on: ubuntu-latest
if: github.ref_name == 'main'
permissions:
contents: write
needs:
Expand Down Expand Up @@ -221,6 +223,34 @@ jobs:
- run: pip install auditwheel
- run: python ./.github/scripts/auditwheel_show.py wheels/* | tee $GITHUB_STEP_SUMMARY

publish-wheels:
name: Publish wheels to PyPI
needs: [build-wheels, audit-wheels]
runs-on: ubuntu-latest
if: |
github.repository == 'bitsandbytes-foundation/bitsandbytes'
&& github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment:
name: release
url: https://pypi.org/p/bitsandbytes
permissions:
id-token: write
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
path: dist/
pattern: "bdist_wheel_*"
merge-multiple: true

- name: Remove macOS wheels
run: rm dist/*macos*

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true

# test:
# needs:
# - build-wheels
Expand Down

0 comments on commit bdf381c

Please sign in to comment.