-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (97 loc) · 3.26 KB
/
python-publish.yml
File metadata and controls
115 lines (97 loc) · 3.26 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Publish Python Package
on:
release:
types: [published]
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
- name: Install dependencies for Python 3.8
if: matrix.python-version == '3.8'
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-3.8.locked
# A workaround for lxml 6.0.1+ package
- name: Install dependencies for PyPy3.9
if: matrix.python-version == 'pypy3.9'
run: |
sudo apt-get install libxml2-dev libxslt1-dev
- name: Install dependencies for Python
if: matrix.python-version != '3.8'
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Create source distribution
run: python -m build --sdist
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pyitt-cibw-sdist
path: dist/*.tar.gz
retention-days: 1
build_wheels:
name: Build wheels on ${{matrix.os}}
runs-on: ${{matrix.os}}
permissions:
contents: read
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
- name: Build wheels
uses: ./.github/actions/python-packages
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pyitt-cibw-wheels-${{matrix.os}}-${{strategy.job-index}}
path: ./wheelhouse/*.whl
retention-days: 1
upload_pypi:
name: Publish to PyPI
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pyitt
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: pyitt-cibw-*
path: ./dist
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
upload_release_artifacts:
name: Upload artifacts to GitHub Release
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{github.ref}}
- name: Download all the dists
id: download-artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: pyitt-cibw-*
path: dist
merge-multiple: true
- name: Upload artifacts
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
for filename in "${{steps.download-artifact.outputs.download-path}}"/*; do
gh release upload "${{github.ref_name}}" "$filename"
done