Skip to content

Commit 1f62749

Browse files
author
Matthias Koeppe
committed
.github/workflows/wheels.yml: New
1 parent b1aed0b commit 1f62749

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/wheels.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build wheels
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
concurrency:
9+
# Cancel previous runs of this workflow for the same branch
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
15+
sdists_for_pypi:
16+
name: Build sdist (and upload to PyPI on release tags)
17+
runs-on: ubuntu-latest
18+
env:
19+
CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-python@v4
23+
- name: make sdist
24+
run: |
25+
python3 -m pip install build
26+
python3 -m build --sdist
27+
- uses: actions/upload-artifact@v3
28+
with:
29+
path: "dist/*.tar.gz"
30+
name: dist
31+
- uses: pypa/gh-action-pypi-publish@release/v1
32+
with:
33+
user: __token__
34+
password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }}
35+
skip_existing: true
36+
verbose: true
37+
if: env.CAN_DEPLOY == 'true' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
38+
39+
build_wheels:
40+
name: Build wheels on ${{ matrix.os }}
41+
runs-on: ${{ matrix.os }}
42+
strategy:
43+
matrix:
44+
os: [ubuntu-latest, macOS-latest]
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
# Used to host cibuildwheel
50+
- uses: actions/setup-python@v4
51+
52+
- name: Build wheels
53+
uses: pypa/[email protected]
54+
55+
- uses: actions/upload-artifact@v3
56+
with:
57+
name: wheels
58+
path: ./wheelhouse/*.whl
59+
60+
pypi-publish:
61+
# https://github.com/pypa/gh-action-pypi-publish
62+
name: Upload wheels to PyPI
63+
needs: build_wheels
64+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
65+
runs-on: ubuntu-latest
66+
env:
67+
CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }}
68+
steps:
69+
70+
- uses: actions/download-artifact@v3
71+
with:
72+
name: wheels
73+
path: wheelhouse
74+
75+
- name: Publish package distributions to PyPI
76+
uses: pypa/gh-action-pypi-publish@release/v1
77+
with:
78+
user: __token__
79+
password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }}
80+
packages_dir: wheelhouse/
81+
skip_existing: true
82+
verbose: true
83+
if: env.CAN_DEPLOY == 'true'

0 commit comments

Comments
 (0)