Skip to content

Commit 25f8d6e

Browse files
ci: add a github workflow to build and publish linux wheels (#250)
1 parent 01493ef commit 25f8d6e

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish Python distribution to PyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-22.04
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
submodules: true
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.x"
18+
19+
- name: Install cibuildwheel
20+
run: python3 -m pip install cibuildwheel==2.16.4
21+
22+
- name: Build wheels
23+
run: python -m cibuildwheel --output-dir dist/
24+
25+
- name: Store the distribution packages
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: python-package-distributions
29+
path: dist/*.whl
30+
31+
publish-to-pypi:
32+
needs: [build]
33+
runs-on: ubuntu-latest
34+
35+
# Only publish to PyPI on tag pushes
36+
if: startsWith(github.ref, 'refs/tags/')
37+
38+
environment:
39+
name: pypi
40+
url: https://pypi.org/p/yara-python
41+
permissions:
42+
id-token: write # IMPORTANT: mandatory for trusted publishing
43+
44+
steps:
45+
- name: Download all the dists
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
51+
- name: Publish distribution to PyPI
52+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)