1
- name : Publish to PyPI.org
2
- on :
3
- release :
4
- types : [published]
1
+ name : Build and upload to PyPI
2
+
3
+ # Build on every branch push, tag push, and pull request change:
4
+ on : [push, pull_request]
5
+ # Alternatively, to publish when a (published) GitHub Release is created, use the following:
6
+ # on:
7
+ # push:
8
+ # pull_request:
9
+ # release:
10
+ # types:
11
+ # - published
12
+
5
13
jobs :
6
- pypi :
14
+ build_wheels :
15
+ name : Build wheels on ${{ matrix.os }}
16
+ runs-on : ${{ matrix.os }}
17
+ strategy :
18
+ matrix :
19
+ os : [ubuntu-20.04, windows-2019, macos-11]
20
+
21
+ steps :
22
+ - uses : actions/checkout@v3
23
+
24
+ - name : Build wheels
25
+
26
+
27
+ - uses : actions/upload-artifact@v3
28
+ with :
29
+ path : ./wheelhouse/*.whl
30
+
31
+ build_sdist :
32
+ name : Build source distribution
33
+ runs-on : ubuntu-latest
34
+ steps :
35
+ - uses : actions/checkout@v3
36
+
37
+ - name : Build sdist
38
+ run : pipx run build --sdist
39
+
40
+ - uses : actions/upload-artifact@v3
41
+ with :
42
+ path : dist/*.tar.gz
43
+
44
+ upload_pypi :
45
+ needs : [build_wheels, build_sdist]
7
46
runs-on : ubuntu-latest
47
+ # to publish when a GitHub Release is created, use the following rule:
48
+ if : github.event_name == 'release' && github.event.action == 'published'
8
49
steps :
9
- - name : Checkout
10
- uses : actions/checkout@v3
50
+ - uses : actions/download-artifact@v3
11
51
with :
12
- fetch-depth : 0
13
- - run : python3 -m pip install --upgrade build && python3 -m build
14
- - name : Publish package
15
- uses : pypa/gh-action-pypi-publish@release/v1
52
+ # unpacks default artifact into dist/
53
+ # if `name: artifact` is omitted, the action will create extra parent dir
54
+ name : artifact
55
+ path : dist
56
+
57
+
16
58
with :
17
- password : ${{ secrets.PYPI_API_TOKEN }}
59
+ user : __token__
60
+ password : ${{ secrets.pypi_password }}
61
+ # To test: repository_url: https://test.pypi.org/legacy/
0 commit comments