Skip to content

Commit a562582

Browse files
committed
chore: add publish-python.yaml
1 parent 0b43eb4 commit a562582

1 file changed

Lines changed: 179 additions & 0 deletions

File tree

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: Publish bdkpython to PyPI
2+
on: [workflow_dispatch]
3+
4+
permissions: {}
5+
6+
jobs:
7+
build-manylinux_2_28-x86_64-wheels:
8+
name: "Build Manylinux 2.28 x86_64 wheel"
9+
runs-on: ubuntu-24.04
10+
container:
11+
image: quay.io/pypa/manylinux_2_28_x86_64
12+
env:
13+
PLAT: manylinux_2_28_x86_64
14+
PYBIN: "/opt/python/${{ matrix.python }}/bin"
15+
strategy:
16+
matrix:
17+
python: # Update this list whenever the docker image is updated (check /opt/python/)
18+
- cp310-cp310
19+
- cp311-cp311
20+
- cp312-cp312
21+
- cp313-cp313
22+
steps:
23+
- name: "Checkout"
24+
uses: actions/checkout@v4
25+
with:
26+
submodules: true
27+
persist-credentials: false
28+
29+
- name: "Install Rust 1.84.1"
30+
uses: actions-rs/toolchain@v1
31+
with:
32+
toolchain: 1.84.1
33+
34+
- name: "Generate bdk.py and binaries"
35+
run: bash ./scripts/generate-linux.sh
36+
37+
- name: "Build wheel"
38+
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
39+
# see issue #350 for more information
40+
run: ${PYBIN}/python setup.py bdist_wheel --plat-name manylinux_2_28_x86_64 --verbose
41+
42+
- uses: actions/upload-artifact@v4
43+
with:
44+
name: bdkpython-manylinux_2_28_x86_64-${{ matrix.python }}
45+
path: /home/runner/work/bdkpython/bdkpython/dist/*.whl
46+
47+
build-macos-arm64-wheels:
48+
name: "Build macOS arm64 wheel"
49+
runs-on: macos-13
50+
strategy:
51+
matrix:
52+
python:
53+
- "3.10"
54+
- "3.11"
55+
- "3.12"
56+
- "3.13"
57+
steps:
58+
- name: "Checkout"
59+
uses: actions/checkout@v4
60+
with:
61+
submodules: true
62+
persist-credentials: false
63+
64+
- name: "Install Python"
65+
uses: actions/setup-python@v4
66+
with:
67+
python-version: ${{ matrix.python }}
68+
69+
- name: "Generate bdk.py and binaries"
70+
run: bash ./scripts/generate-macos-arm64.sh
71+
72+
- name: "Build wheel"
73+
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
74+
# see issue #350 for more information
75+
run: python3 setup.py bdist_wheel --plat-name macosx_11_0_arm64 --verbose
76+
77+
- name: "Upload artifacts"
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: bdkpython-macos-arm64-${{ matrix.python }}
81+
path: /Users/runner/work/bdkpython/bdkpython/dist/*.whl
82+
83+
build-macos-x86_64-wheels:
84+
name: "Build macOS x86_64 wheel"
85+
runs-on: macos-13
86+
strategy:
87+
matrix:
88+
python:
89+
- "3.10"
90+
- "3.11"
91+
- "3.12"
92+
- "3.13"
93+
steps:
94+
- name: "Checkout"
95+
uses: actions/checkout@v4
96+
with:
97+
submodules: true
98+
persist-credentials: false
99+
100+
- name: "Install Python"
101+
uses: actions/setup-python@v4
102+
with:
103+
python-version: ${{ matrix.python }}
104+
105+
- name: "Generate bdk.py and binaries"
106+
run: bash ./scripts/generate-macos-x86_64.sh
107+
108+
- name: "Build wheel"
109+
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
110+
# see issue #350 for more information
111+
run: python3 setup.py bdist_wheel --plat-name macosx_11_0_x86_64 --verbose
112+
113+
- uses: actions/upload-artifact@v4
114+
with:
115+
name: bdkpython-macos-x86_64-${{ matrix.python }}
116+
path: /Users/runner/work/bdkpython/bdkpython/dist/*.whl
117+
118+
build-windows-wheels:
119+
name: "Build Windows wheel"
120+
runs-on: windows-2022
121+
strategy:
122+
matrix:
123+
python:
124+
- "3.10"
125+
- "3.11"
126+
- "3.12"
127+
- "3.13"
128+
steps:
129+
- name: "Checkout"
130+
uses: actions/checkout@v4
131+
with:
132+
submodules: true
133+
persist-credentials: false
134+
135+
- uses: actions/setup-python@v4
136+
with:
137+
python-version: ${{ matrix.python }}
138+
139+
- name: "Generate bdk.py and binaries"
140+
run: bash ./scripts/generate-windows.sh
141+
142+
- name: "Build wheel"
143+
run: python setup.py bdist_wheel --verbose
144+
145+
- name: "Upload artifacts"
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: bdkpython-win-${{ matrix.python }}
149+
path: D:\a\bdkpython\bdkpython\dist\*.whl
150+
151+
publish-pypi:
152+
name: "Publish on PyPI"
153+
runs-on: ubuntu-24.04
154+
needs: [build-manylinux_2_28-x86_64-wheels, build-macos-arm64-wheels, build-macos-x86_64-wheels, build-windows-wheels]
155+
steps:
156+
- name: "Checkout"
157+
uses: actions/checkout@v4
158+
with:
159+
persist-credentials: false
160+
161+
- name: "Download artifacts in dist/ directory"
162+
uses: actions/download-artifact@v4
163+
with:
164+
path: dist/
165+
166+
# - name: "Publish on test PyPI"
167+
# uses: pypa/gh-action-pypi-publish@release/v1
168+
# with:
169+
# user: __token__
170+
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
171+
# repository_url: https://test.pypi.org/legacy/
172+
# packages_dir: dist/*/
173+
174+
- name: "Publish on PyPI"
175+
uses: pypa/gh-action-pypi-publish@release/v1
176+
with:
177+
user: __token__
178+
password: ${{ secrets.PYPI_API_TOKEN }}
179+
packages_dir: dist/*/

0 commit comments

Comments
 (0)