Skip to content

Commit aeabb24

Browse files
committed
Update publish.yml
1 parent f433b0e commit aeabb24

File tree

1 file changed

+39
-49
lines changed

1 file changed

+39
-49
lines changed

.github/workflows/publish.yml

+39-49
Original file line numberDiff line numberDiff line change
@@ -18,69 +18,59 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v4
2020

21-
- uses: actions/setup-python@v5
22-
with:
23-
python-version: '3.12'
24-
25-
- name: Install cibuildwheel
26-
run: python -m pip install cibuildwheel==2.16.2
27-
28-
- name: Build wheels for Linux
29-
if: matrix.os == 'ubuntu-latest'
30-
run: |
31-
python -m cibuildwheel --output-dir wheelhouse
32-
env:
33-
CIBW_SKIP: "pp* *i686* *musllinux*"
34-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
35-
CIBW_BEFORE_BUILD: pip install --verbose --editable .
36-
37-
- name: Build wheels for Windows
38-
if: matrix.os == 'windows-latest'
39-
run: |
40-
python -m cibuildwheel --output-dir wheelhouse
41-
env:
42-
CIBW_SKIP: "pp* *i686* *win32"
43-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
44-
CIBW_BEFORE_BUILD: pip install --verbose --editable .
45-
46-
- name: Build wheels for macOS
47-
if: matrix.os == 'macos-latest'
48-
run: |
49-
python -m cibuildwheel --output-dir wheelhouse
21+
- name: Build wheels
22+
uses: pypa/[email protected]
5023
env:
51-
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
52-
CIBW_SKIP: "pp* *i686*"
24+
CIBW_BUILD: cp3*-*
25+
CIBW_SKIP: pp* *i686* *win32 *musllinux*
5326
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
5427
CIBW_BEFORE_BUILD: pip install --verbose --editable .
28+
CIBW_ARCHS_LINUX: auto64
29+
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
30+
CIBW_ARCHS_WINDOWS: auto64
5531

5632
- uses: actions/upload-artifact@v4
5733
with:
58-
name: ${{ matrix.os }}-artifact
34+
name: artifact-wheels-${{ matrix.os }}
5935
path: ./wheelhouse/*.whl
6036

37+
build_sdist:
38+
name: Build source distribution
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- uses: actions/setup-python@v5
44+
name: Install Python
45+
with:
46+
python-version: '3.12'
47+
48+
- run: pip install build
49+
50+
- name: Build sdist
51+
run: python -m build --sdist
52+
53+
- uses: actions/upload-artifact@v4
54+
with:
55+
name: artifact-source
56+
path: dist/*.tar.gz
57+
6158
upload_pypi:
62-
needs: build_wheels
59+
needs: [build_wheels, build_sdist]
6360
runs-on: ubuntu-latest
6461

6562
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
6663
steps:
67-
- uses: actions/checkout@v4
68-
6964
- uses: actions/download-artifact@v4
7065
with:
71-
name: artifact
7266
path: dist
67+
pattern: artifact-*
68+
merge-multiple: true
7369

74-
- name: Install dependencies
75-
run: |
76-
python -m pip install --upgrade pip
77-
pip install build
78-
pip install twine
79-
80-
- name: Publish
81-
env:
82-
TWINE_USERNAME: __token__
83-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
84-
run: |
85-
python -m build --sdist
86-
twine upload dist/*
70+
- uses: pypa/[email protected]
71+
with:
72+
user: __token__
73+
password: ${{ secrets.PYPI_PASSWORD }}
74+
# To test, uncomment the following:
75+
# password: ${{ secrets.TEST_PYPI_PASSWORD }}
76+
# repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)