-
-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (124 loc) · 4.04 KB
/
Copy pathpypi-release.yml
File metadata and controls
159 lines (124 loc) · 4.04 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Create library release archives, create a GH release and publish PyPI wheel and sdist on tag in main branch
# This is executed automatically on a tag in the main branch
# Summary of the steps:
# - build wheels and sdist
# - upload wheels and sdist to PyPI
# - create gh-release and upload wheels and dists there
# TODO: smoke test wheels and sdist
# TODO: add changelog to release text body
# WARNING: this is designed only for packages building as pure Python wheels
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
build-pypi-distribs-sdist:
name: Build and upload sdist
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install build, twine, pkginfo, and packaging
run: python -m pip install --user --upgrade build twine pkginfo packaging
- name: Build sdist
run: python -m build --sdist --outdir dist/
- name: Validate sdist for Pypi
run: python -m twine check dist/*
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: pypi_archives-sdist
path: dist/*
build-pypi-distribs-wheels:
name: Build and upload wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install cibuildwheel, twine, pkginfo, and packaging
run: python -m pip install --user --upgrade cibuildwheel twine pkginfo packaging
- name: Build wheels
run: python -m cibuildwheel --output-dir dist/
- name: Validate wheels for Pypi
run: python -m twine check dist/*
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: pypi_archives-${{ matrix.os }}
path: dist/*
create-gh-release:
name: Create GH release
needs:
- build-pypi-distribs-sdist
- build-pypi-distribs-wheels
runs-on: ubuntu-24.04
steps:
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: pypi_archives-sdist
path: dist
- name: Download ubuntu-latest builds
uses: actions/download-artifact@v4
with:
name: pypi_archives-ubuntu-latest
path: dist
- name: Download windows-latest builds
uses: actions/download-artifact@v4
with:
name: pypi_archives-windows-latest
path: dist
- name: Download macos-13 builds
uses: actions/download-artifact@v4
with:
name: pypi_archives-macos-13
path: dist
- name: Download macos-latest builds
uses: actions/download-artifact@v4
with:
name: pypi_archives-macos-latest
path: dist
- name: Create GH release
uses: softprops/action-gh-release@v2
with:
draft: true
files: dist/*
create-pypi-release:
name: Create PyPI release
needs:
- create-gh-release
runs-on: ubuntu-24.04
steps:
- name: Download ubuntu-latest builds
uses: actions/download-artifact@v4
with:
name: pypi_archives-ubuntu-latest
path: dist
- name: Download windows-latest builds
uses: actions/download-artifact@v4
with:
name: pypi_archives-windows-latest
path: dist
- name: Download macos-13 builds
uses: actions/download-artifact@v4
with:
name: pypi_archives-macos-13
path: dist
- name: Download macos-latest builds
uses: actions/download-artifact@v4
with:
name: pypi_archives-macos-latest
path: dist
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}