-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (105 loc) · 2.98 KB
/
publish-python-package.yml
File metadata and controls
126 lines (105 loc) · 2.98 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Publish Python Package
on:
workflow_dispatch:
push:
tags:
- "v*"
permissions:
contents: read
id-token: write
jobs:
sdist:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Prepare release version
run: |
version="$(python scripts/resolve_version.py)"
python scripts/set_version.py "$version"
- name: Check version consistency
run: python scripts/check_version.py
- name: Build sdist
run: |
python -m pip install --upgrade build twine
python -m build --sdist
python -m twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: python-sdist
path: dist/*.tar.gz
wheels:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64
os: ubuntu-24.04
archs: x86_64
build: "cp310-* cp311-* cp312-* cp313-*"
- name: linux-riscv64
os: ubuntu-24.04
archs: riscv64
build: "cp312-*"
- name: macos-arm64
os: macos-14
archs: arm64
build: "cp310-* cp311-* cp312-* cp313-*"
- name: windows-x86_64
os: windows-2022
archs: AMD64
build: "cp310-* cp311-* cp312-* cp313-*"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU for riscv64
if: matrix.archs == 'riscv64'
uses: docker/setup-qemu-action@v3
with:
platforms: riscv64
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Prepare release version
run: |
version="$(python scripts/resolve_version.py)"
python scripts/set_version.py "$version"
- name: Check version consistency
run: python scripts/check_version.py
- uses: dtolnay/rust-toolchain@stable
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==3.4.1
- name: Build wheels
env:
CIBW_ARCHS: ${{ matrix.archs }}
CIBW_BUILD: ${{ matrix.build }}
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: python-wheels-${{ matrix.name }}
path: wheelhouse/*.whl
publish:
runs-on: ubuntu-24.04
needs:
- sdist
- wheels
environment:
name: pypi
url: https://pypi.org/project/embeddings-cpp/
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: python-*
merge-multiple: true
- name: List distributions
run: ls -lh dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1