Skip to content

Commit 7958cf7

Browse files
committed
Try to publish and fix publish workflow #2
1 parent e315fba commit 7958cf7

File tree

1 file changed

+107
-133
lines changed

1 file changed

+107
-133
lines changed

.github/workflows/publish.yml

Lines changed: 107 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# This file is autogenerated by maturin v1.8.2
2-
# To update, run
3-
#
4-
# maturin generate-ci github
5-
#
61
name: publish
72

83
on:
@@ -15,166 +10,145 @@ permissions:
1510
contents: read
1611

1712
jobs:
18-
linux:
19-
runs-on: ${{ matrix.platform.runner }}
20-
strategy:
21-
matrix:
22-
platform:
23-
- runner: ubuntu-22.04
24-
target: x86_64
25-
- runner: ubuntu-22.04
26-
target: x86
27-
- runner: ubuntu-22.04
28-
target: aarch64
29-
- runner: ubuntu-22.04
30-
target: armv7
31-
- runner: ubuntu-22.04
32-
target: s390x
33-
- runner: ubuntu-22.04
34-
target: ppc64le
13+
sdist:
14+
name: build sdist
15+
runs-on: ubuntu-latest
3516
steps:
3617
- uses: actions/checkout@v4
3718
- uses: actions/setup-python@v5
3819
with:
39-
python-version: 3.x
40-
41-
- name: Build wheels
42-
uses: PyO3/maturin-action@v1
20+
python-version: '3.13'
21+
- uses: PyO3/maturin-action@v1
4322
with:
44-
target: ${{ matrix.platform.target }}
45-
args: --release --out dist --find-interpreter
46-
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
47-
manylinux: auto
48-
- name: Upload wheels
49-
uses: actions/upload-artifact@v4
23+
command: sdist
24+
args: --out dist
25+
rust-toolchain: stable
26+
- uses: actions/upload-artifact@v4
5027
with:
51-
name: wheels-linux-${{ matrix.platform.target }}
28+
name: pypi_files_sdist
5229
path: dist
5330

54-
musllinux:
55-
runs-on: ${{ matrix.platform.runner }}
31+
build:
32+
name: build on ${{ matrix.os }} (${{ matrix.target }} - ${{ matrix.interpreter || 'all' }}${{ matrix.os == 'linux' && format(' - {0}', matrix.manylinux == 'auto' && 'manylinux' || matrix.manylinux) || '' }})
33+
if: startsWith(github.ref, 'refs/tags/')
5634
strategy:
35+
fail-fast: false
5736
matrix:
58-
platform:
59-
- runner: ubuntu-22.04
37+
os: [linux, macos, windows]
38+
target: [x86_64, aarch64]
39+
manylinux: [auto]
40+
include:
41+
# manylinux
42+
- os: linux
43+
manylinux: auto
44+
target: i686
45+
- os: linux
46+
manylinux: auto
47+
target: aarch64
48+
- os: linux
49+
manylinux: auto
50+
target: armv7
51+
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13
52+
- os: linux
53+
manylinux: auto
54+
target: ppc64le
55+
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13
56+
- os: linux
57+
manylinux: auto
58+
target: s390x
59+
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13
60+
- os: linux
61+
manylinux: auto
6062
target: x86_64
61-
- runner: ubuntu-22.04
62-
target: x86
63-
- runner: ubuntu-22.04
63+
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
64+
65+
# musllinux
66+
- os: linux
67+
manylinux: musllinux_1_1
68+
target: x86_64
69+
- os: linux
70+
manylinux: musllinux_1_1
6471
target: aarch64
65-
- runner: ubuntu-22.04
72+
- os: linux
73+
manylinux: musllinux_1_1
6674
target: armv7
67-
steps:
68-
- uses: actions/checkout@v4
69-
- uses: actions/setup-python@v5
70-
with:
71-
python-version: 3.x
72-
- name: Build wheels
73-
uses: PyO3/maturin-action@v1
74-
with:
75-
target: ${{ matrix.platform.target }}
76-
args: --release --out dist --find-interpreter
77-
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
78-
manylinux: musllinux_1_2
79-
- name: Upload wheels
80-
uses: actions/upload-artifact@v4
81-
with:
82-
name: wheels-musllinux-${{ matrix.platform.target }}
83-
path: dist
8475

85-
windows:
86-
runs-on: ${{ matrix.platform.runner }}
87-
strategy:
88-
matrix:
89-
platform:
90-
- runner: windows-latest
91-
target: x64
92-
- runner: windows-latest
93-
target: x86
94-
steps:
95-
- uses: actions/checkout@v4
96-
- uses: actions/setup-python@v5
97-
with:
98-
python-version: 3.x
99-
architecture: ${{ matrix.platform.target }}
100-
- name: Build wheels
101-
uses: PyO3/maturin-action@v1
102-
with:
103-
target: ${{ matrix.platform.target }}
104-
args: --release --out dist --find-interpreter
105-
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
106-
- name: Upload wheels
107-
uses: actions/upload-artifact@v4
108-
with:
109-
name: wheels-windows-${{ matrix.platform.target }}
110-
path: dist
76+
# macos
77+
- os: macos
78+
target: x86_64
79+
- os: macos
80+
target: aarch64
81+
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
11182

112-
macos:
113-
runs-on: ${{ matrix.platform.runner }}
114-
strategy:
115-
matrix:
116-
platform:
117-
- runner: macos-13
83+
# windows
84+
- os: windows
11885
target: x86_64
119-
- runner: macos-14
86+
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13
87+
- os: windows
88+
target: i686
89+
python-architecture: x86
90+
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13
91+
92+
exclude:
93+
- os: windows
12094
target: aarch64
95+
96+
runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest
12197
steps:
12298
- uses: actions/checkout@v4
123-
- uses: actions/setup-python@v5
99+
100+
- name: set up python
101+
uses: actions/setup-python@v5
124102
with:
125-
python-version: 3.x
126-
- name: Build wheels
103+
python-version: '3.13'
104+
architecture: ${{ matrix.python-architecture || 'x64' }}
105+
106+
- run: pip install -U twine
107+
108+
- name: build wheels
127109
uses: PyO3/maturin-action@v1
128110
with:
129-
target: ${{ matrix.platform.target }}
130-
args: --release --out dist --find-interpreter
131-
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
132-
- name: Upload wheels
133-
uses: actions/upload-artifact@v4
111+
target: ${{ matrix.target }}
112+
manylinux: ${{ matrix.manylinux }}
113+
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' }}
114+
rust-toolchain: ${{ (matrix.os == 'windows' && '1.77') || 'stable' }}
115+
docker-options: -e CI
116+
117+
- run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} dist/
118+
119+
- run: twine check --strict dist/*
120+
121+
- uses: actions/upload-artifact@v4
134122
with:
135-
name: wheels-macos-${{ matrix.platform.target }}
123+
name: pypi_files_${{ matrix.os }}_${{ matrix.target }}_${{ matrix.interpreter || 'all' }}_${{ matrix.manylinux }}
136124
path: dist
137125

138-
sdist:
126+
release:
127+
needs: [build, sdist]
128+
if: success() && startsWith(github.ref, 'refs/tags/')
139129
runs-on: ubuntu-latest
130+
140131
steps:
141132
- uses: actions/checkout@v4
142133

143-
- name: Build sdist
144-
uses: PyO3/maturin-action@v1
134+
- name: set up python
135+
uses: actions/setup-python@v5
145136
with:
146-
command: sdist
147-
args: --out dist
148-
- name: Upload sdist
149-
uses: actions/upload-artifact@v4
137+
python-version: '3.13'
138+
139+
- run: pip install -U twine
140+
141+
- name: get dist artifacts
142+
uses: actions/download-artifact@v4
150143
with:
151-
name: wheels-sdist
144+
pattern: pypi_files_*
145+
merge-multiple: true
152146
path: dist
153147

154-
release:
155-
name: Release
156-
runs-on: ubuntu-latest
157-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
158-
needs: [linux, musllinux, windows, macos, sdist]
159-
permissions:
160-
# Use to sign the release artifacts
161-
id-token: write
162-
# Used to upload release artifacts
163-
contents: write
164-
# Used to generate artifact attestation
165-
attestations: write
166-
steps:
167-
- uses: actions/download-artifact@v4
168-
- name: Generate artifact attestation
169-
uses: actions/attest-build-provenance@v1
170-
with:
171-
subject-path: 'wheels-*/*'
148+
- run: twine check --strict dist/*
172149

173-
- name: Publish to PyPI
174-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
175-
uses: PyO3/maturin-action@v1
150+
- name: upload to pypi
151+
run: twine upload dist/*
176152
env:
177-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
178-
with:
179-
command: upload
180-
args: --non-interactive --skip-existing wheels-*/*
153+
TWINE_USERNAME: __token__
154+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)