66 tags : [v*]
77
88jobs :
9- deploy :
9+ build-sdist :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout code
13+ uses : actions/checkout@v3
14+ with :
15+ # checkout full history for setuptools-scm
16+ fetch-depth : 0
17+ submodules : recursive
18+
19+ - name : Set up Python
20+ uses : actions/setup-python@v4
21+ with :
22+ python-version : ' 3.10'
23+
24+ - name : Build sdist
25+ run : |
26+ pip install tox
27+ tox -e sdist
28+
29+ - name : Upload sdist artifact
30+ uses : actions/upload-artifact@v3
31+ with :
32+ name : sdist
33+ path : dist/*.tar.gz
34+ if-no-files-found : error
35+ retention-days : 3
36+
37+ build-wheels :
38+ needs : ["build-sdist"]
1039 strategy :
1140 matrix :
1241 include :
4776 path : ${{ github.event.repository.name }}
4877 submodules : recursive
4978
79+ - name : Download sdist artifact
80+ uses : actions/download-artifact@v3
81+ with :
82+ name : sdist
83+ path : pkgcraft-python/dist
84+
5085 - name : Set up Python
5186 uses : actions/setup-python@v4
5287 with :
@@ -58,36 +93,46 @@ jobs:
5893 with :
5994 platforms : ${{ matrix.arch }}
6095
61- - name : Build sdist and wheels
96+ - name : Build wheels
6297 run : ./build-wheels ${{ matrix.arch }}
6398
99+ - name : Verify wheels
100+ run : |
101+ pip install twine
102+ twine check pkgcraft-python/wheels/*
103+
64104 - name : Upload build artifacts
65105 uses : actions/upload-artifact@v3
66106 with :
67- name : pkgcraft-python
68- path : |
69- pkgcraft-python/dist/
70- pkgcraft-python/wheels/
107+ name : wheels
108+ path : pkgcraft-python/wheels/
71109 if-no-files-found : error
72- retention-days : 1
110+ retention-days : 3
111+
112+ publish :
113+ if : startsWith(github.ref, 'refs/tags/')
114+ needs : ["build-sdist", "build-wheels"]
115+ runs-on : ubuntu-latest
116+ steps :
117+ - name : Download sdist and wheel artifacts
118+ uses : actions/download-artifact@v3
73119
74120 - name : Upload sdist to PyPI
75121 uses : pypa/gh-action-pypi-publish@release/v1
76- if : ${{ runner.os == 'Linux' && matrix.arch == 'x86_64' && startsWith(github.ref, 'refs/tags/') }}
77122 with :
78123 password : ${{ secrets.PYPI_API_TOKEN }}
79- packages_dir : pkgcraft-python/dist/
124+ packages_dir : sdist/
125+ print_hash : true
80126
81127 - name : Upload wheels to PyPI
82128 uses : pypa/gh-action-pypi-publish@release/v1
83- if : startsWith(github.ref, 'refs/tags/')
84129 with :
85130 password : ${{ secrets.PYPI_API_TOKEN }}
86- packages_dir : pkgcraft-python/wheels/
131+ packages_dir : wheels/
132+ print_hash : true
87133
88134 - name : Create GitHub release
89135 uses : softprops/action-gh-release@v1
90- if : ${{ runner.os == 'Linux' && matrix.arch == 'x86_64' && startsWith(github.ref, 'refs/tags/') }}
91136 with :
92- files : pkgcraft-python/dist /*.tar.gz
137+ files : sdist /*.tar.gz
93138 fail_on_unmatched_files : true
0 commit comments