File tree Expand file tree Collapse file tree 1 file changed +89
-0
lines changed
Expand file tree Collapse file tree 1 file changed +89
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Publish Python Package
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ version :
7+ description : " Version to use for the Python package (e.g. 0.5.9)"
8+ required : true
9+ type : string
10+ release :
11+ types : [published]
12+
13+ jobs :
14+ build-and-publish :
15+ runs-on : ${{ matrix.os }}
16+ strategy :
17+ matrix :
18+ include :
19+ - os : ubuntu-latest
20+ platform : linux
21+ python-version : " 3.10"
22+ arch : x86_64
23+ plat_name : linux_x86_64
24+ - os : ubuntu-latest
25+ platform : linux
26+ python-version : " 3.10"
27+ arch : arm64
28+ plat_name : linux_aarch64
29+ - os : windows-latest
30+ platform : windows
31+ python-version : " 3.10"
32+ arch : x86_64
33+ plat_name : win_amd64
34+ - os : macos-latest
35+ platform : macos
36+ python-version : " 3.10"
37+ arch : x86_64
38+ plat_name : macosx_10_9_x86_64
39+ - os : macos-latest
40+ platform : macos
41+ python-version : " 3.10"
42+ arch : arm64
43+ plat_name : macosx_11_0_arm64
44+ defaults :
45+ run :
46+ shell : bash
47+ steps :
48+ - uses : actions/checkout@v4
49+ with :
50+ submodules : false
51+
52+ - name : Set up Python
53+ uses : actions/setup-python@v5
54+ with :
55+ python-version : ${{ matrix.python-version }}
56+
57+ - name : Install build dependencies
58+ run : |
59+ cd python-package
60+ python3 -m pip install --upgrade pip
61+ pip install .[dev]
62+
63+ - name : Get version
64+ id : get_version
65+ run : |
66+ if [[ "${{ github.event_name }}" == "release" ]]; then
67+ VERSION="${{ github.event.release.tag_name }}"
68+ else
69+ VERSION="${{ github.event.inputs.version }}"
70+ fi
71+ VERSION=${VERSION#v}
72+ echo "version=$VERSION" >> $GITHUB_OUTPUT
73+
74+ - name : Download artifacts for current platform
75+ run : |
76+ python3 download_artifacts.py "${{ matrix.plat_name }}" "${{ steps.get_version.outputs.version }}"
77+
78+ - name : Build wheel
79+ env :
80+ PACKAGE_VERSION : ${{ steps.get_version.outputs.version }}
81+ run : |
82+ cd python-package
83+ python setup.py clean --all bdist_wheel --plat-name "${{ matrix.plat_name }}"
84+
85+ - name : Publish to PyPI
86+ if : github.event_name == 'release'
87+ uses : pypa/gh-action-pypi-publish@release/v1
88+ with :
89+ packages-dir : python-package/dist
You can’t perform that action at this time.
0 commit comments