-
Notifications
You must be signed in to change notification settings - Fork 330
66 lines (56 loc) · 1.67 KB
/
pypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Publish to PyPI.org
on:
release:
types: [published]
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
run: pipx run build --sdist ${{github.workspace}}/python/
- name: Move sdist to dist
run: mkdir -p dist && mv ${{github.workspace}}/python/dist/*.tar.gz dist/
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
cibuildwheel:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-14]
steps:
- uses: actions/checkout@v3
- name: Build test wheels (only PRs)
if: github.event_name != 'release'
uses: pypa/[email protected]
env: # build 1 build per platform just to make sure we can do it later when releasing
CIBW_BUILD: "cp310-*"
with:
package-dir: ${{github.workspace}}/python/
- name: Build all wheels
if: github.event_name == 'release'
uses: pypa/[email protected]
with:
package-dir: ${{github.workspace}}/python/
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
pypi:
if: github.event_name == 'release'
needs: [cibuildwheel, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}