Skip to content

Commit 5d399a6

Browse files
authored
Update python-publish.yml (#47)
1 parent c9fc4b0 commit 5d399a6

File tree

1 file changed

+40
-19
lines changed

1 file changed

+40
-19
lines changed

.github/workflows/python-publish.yml

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 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/
33

44
# This workflow uses actions that are not certified by GitHub.
55
# They are provided by a third-party and are governed by
@@ -15,27 +15,48 @@ on:
1515
permissions:
1616
contents: read
1717

18+
1819
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+
uses: pypa/[email protected]
32+
33+
- uses: actions/upload-artifact@v3
34+
with:
35+
path: ./wheelhouse/*.whl
2036

37+
build_sdist:
38+
name: Build source distribution
2139
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v3
42+
43+
- name: Build sdist
44+
run: pipx run build --sdist
2245

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
2356
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
4161

62+
- uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)