Skip to content

Commit 91b9b20

Browse files
committed
prep for pypi
1 parent 34e0f82 commit 91b9b20

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build and upload to PyPI
2+
3+
# Build on every branch push, tag push, and pull request change:
4+
#on: [push, pull_request]
5+
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
6+
on:
7+
release:
8+
types:
9+
- published
10+
11+
jobs:
12+
build_wheels:
13+
name: Build wheels on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, windows-latest, macos-latest]
18+
19+
steps:
20+
- name: Setup C/C++ Compiler
21+
id: install_cc
22+
uses: rlalik/[email protected]
23+
with:
24+
compiler: gcc #clang
25+
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Build wheels
30+
env:
31+
CC: '${{ steps.install_cc.outputs.cc }}'
32+
CXX: '${{ steps.install_cc.outputs.cxx }}'
33+
uses: pypa/[email protected]
34+
35+
- uses: actions/upload-artifact@v3
36+
with:
37+
path: ./wheelhouse/*.whl
38+
39+
build_sdist:
40+
name: Build source distribution
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- name: Build sdist
46+
run: pipx run build --sdist
47+
48+
- uses: actions/upload-artifact@v3
49+
with:
50+
path: dist/*.tar.gz
51+
52+
upload_pypi:
53+
needs: [build_wheels, build_sdist]
54+
runs-on: ubuntu-latest
55+
# upload to PyPI on every tag starting with 'v'
56+
#if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
57+
# alternatively, to publish when a GitHub Release is created, use the following rule:
58+
if: github.event_name == 'release' && github.event.action == 'published'
59+
steps:
60+
- uses: actions/download-artifact@v3
61+
with:
62+
# unpacks default artifact into dist/
63+
# if `name: artifact` is omitted, the action will create extra parent dir
64+
name: artifact
65+
path: dist
66+
67+
- uses: pypa/[email protected]
68+
with:
69+
user: __token__
70+
password: ${{ secrets.pypi_password }}
71+
# To test: repository_url: https://test.pypi.org/legacy/

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ nosetests.xml
3737
.mr.developer.cfg
3838
.project
3939
.pydevproject
40+
41+
# Emacs
42+
*~

0 commit comments

Comments
 (0)