ci: add a github workflow to build and publish linux wheels (#250) #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Python distribution to PyPI | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install cibuildwheel | |
run: python3 -m pip install cibuildwheel==2.16.4 | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir dist/ | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/*.whl | |
publish-to-pypi: | |
needs: [build] | |
runs-on: ubuntu-latest | |
# Only publish to PyPI on tag pushes | |
if: startsWith(github.ref, 'refs/tags/') | |
environment: | |
name: pypi | |
url: https://pypi.org/p/yara-python | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |