|
1 | 1 | # This workflow will upload a Python Package using Twine when a release is created
|
2 |
| -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries |
| 2 | +# For more information see: https://cibuildwheel.readthedocs.io/en/stable/deliver-to-pypi/ |
3 | 3 |
|
4 | 4 | # This workflow uses actions that are not certified by GitHub.
|
5 | 5 | # They are provided by a third-party and are governed by
|
|
15 | 15 | permissions:
|
16 | 16 | contents: read
|
17 | 17 |
|
| 18 | + |
18 | 19 | jobs:
|
19 |
| - deploy: |
| 20 | + build_wheels: |
| 21 | + name: Build wheels on ${{ matrix.os }} |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + os: [ubuntu-22.04, windows-2022, macos-11] |
| 26 | + |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v3 |
| 29 | + |
| 30 | + - name: Build wheels |
| 31 | + |
| 32 | + |
| 33 | + - uses: actions/upload-artifact@v3 |
| 34 | + with: |
| 35 | + path: ./wheelhouse/*.whl |
20 | 36 |
|
| 37 | + build_sdist: |
| 38 | + name: Build source distribution |
21 | 39 | runs-on: ubuntu-latest
|
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v3 |
| 42 | + |
| 43 | + - name: Build sdist |
| 44 | + run: pipx run build --sdist |
22 | 45 |
|
| 46 | + - uses: actions/upload-artifact@v3 |
| 47 | + with: |
| 48 | + path: dist/*.tar.gz |
| 49 | + |
| 50 | + upload_pypi: |
| 51 | + needs: [build_wheels, build_sdist] |
| 52 | + runs-on: ubuntu-latest |
| 53 | + environment: pypi |
| 54 | + permissions: |
| 55 | + id-token: write |
23 | 56 | steps:
|
24 |
| - - uses: actions/checkout@v3 |
25 |
| - - name: Set up Python |
26 |
| - uses: actions/setup-python@v3 |
27 |
| - with: |
28 |
| - python-version: '3.x' |
29 |
| - - name: Install dependencies |
30 |
| - run: | |
31 |
| - python -m pip install --upgrade pip |
32 |
| - pip install build |
33 |
| - - name: Build package |
34 |
| - # PyPI does not allow to upload wheels built using linux_x86_64 |
35 |
| - run: python -m build --sdist |
36 |
| - - name: Publish package |
37 |
| - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 |
38 |
| - with: |
39 |
| - user: __token__ |
40 |
| - password: ${{ secrets.PYPI_API_TOKEN }} |
| 57 | + - uses: actions/download-artifact@v3 |
| 58 | + with: |
| 59 | + name: artifact |
| 60 | + path: dist |
41 | 61 |
|
| 62 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments