This repository was archived by the owner on May 21, 2025. It is now read-only.
add basic PyPI packaging workflow via trusted publishing #1
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: PyPi packaging | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: {} | ||
| jobs: | ||
| # TODO: add testing functionality on Intel runner, by Intel team | ||
| # test: | ||
| # runs-on: ubuntu-latest | ||
| # strategy: | ||
| # matrix: | ||
| # python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
| # steps: | ||
| # - uses: actions/checkout@v4 | ||
| # - name: Set up Python ${{ matrix.python-version }} | ||
| # uses: actions/setup-python@v5 | ||
| # with: | ||
| # python-version: ${{ matrix.python-version }} | ||
| # cache: pip | ||
| # - name: Install dependencies | ||
| # run: | | ||
| # python -m pip install --upgrade pip | ||
| # pip install pytest | ||
| # pip install -e . | ||
| # - name: Test with pytest | ||
| # run: pytest | ||
| build-and-publish: | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'release' && github.event.action == 'published' | ||
| environment: | ||
| name: release | ||
| url: https://pypi.org/p/bitsandbytes-intel | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.10" | ||
| - name: Install build dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install build wheel | ||
| - name: Build package | ||
| run: python -m build | ||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||