-
Notifications
You must be signed in to change notification settings - Fork 44
84 lines (79 loc) · 2.04 KB
/
build_for_pypi.yml
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
---
name: Build and Optionally Publish to PyPi
on:
pull_request:
branches:
- main
push:
# Pattern matched against refs/tags
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build_src_for_pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
submodules: true
- name: Install dependencies
run: |
pip install build
- name: Build src dist
run: |
python -m build --sdist
env:
PIP_CONSTRAINT: requirements.txt
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: ./**/*.tar.gz
build_dist_for_pypi:
needs:
- build_src_for_pypi
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-13
- macos-latest
- ubuntu-24.04-arm
- ubuntu-latest
- windows-latest
steps:
- name: Download the sdist
uses: actions/download-artifact@v4
with:
name: cibw-sdist
- name: Get sdist filename
id: get-sdist
run: |
echo "sdist_filename=$(ls dist/)" >> "${GITHUB_OUTPUT}"
shell: bash
- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: dist/${{ steps.get-sdist.outputs.sdist_filename }}
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
publish_to_pypi:
if: github.ref_type == 'tag'
needs:
- build_dist_for_pypi
- build_src_for_pypi
permissions:
id-token: write # This is required for OIDC
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: cibw-*
- name: Publish package to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true