Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 67b3b90

Browse files
committed
Add pypi uploader
1 parent 8fb907a commit 67b3b90

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/pypi.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copied from: https://github.com/joerick/cibuildwheel/blob/master/examples/github-deploy.yml
2+
name: Build and upload to PyPI
3+
on:
4+
push:
5+
branches:
6+
- master
7+
release:
8+
types:
9+
- published
10+
workflow_dispatch:
11+
inputs:
12+
upload:
13+
description: 'Upload to PyPi'
14+
required: false
15+
default: 'false'
16+
17+
jobs:
18+
build_wheels:
19+
name: Build wheels on ${{ matrix.os }}
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [macos-10.15, ubuntu-20.04]
25+
steps:
26+
- uses: actions/checkout@v2
27+
- uses: actions/setup-python@v2
28+
name: Install Python
29+
with:
30+
python-version: '3.8'
31+
- name: Build wheels
32+
uses: joerick/[email protected]
33+
env:
34+
CIBW_BEFORE_ALL_LINUX: "apt-get update && apt-get install -y gcc gfortran"
35+
CIBW_BEFORE_ALL_MACOS: "brew unlink gcc && brew link gcc" # gfortran and libs don't seem to be linked by default for some reason
36+
# Use debian builders
37+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_24
38+
# Skip extra linux cpu archs and pypy
39+
CIBW_SKIP: "*_aarch64 *_i686 *_ppc64le *_s390x pp*"
40+
- uses: actions/upload-artifact@v2
41+
with:
42+
path: ./wheelhouse/*.whl
43+
build_sdist:
44+
name: Build source distribution
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- uses: actions/setup-python@v2
49+
name: Install Python
50+
with:
51+
python-version: '3.8'
52+
- name: Build sdist
53+
run: pip install build && python -m build --sdist
54+
- uses: actions/upload-artifact@v2
55+
with:
56+
path: dist/*.tar.gz
57+
upload_pypi:
58+
needs: [build_wheels, build_sdist]
59+
runs-on: ubuntu-latest
60+
if: (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'workflow_dispatch' && github.event.inputs.upload == 'true')
61+
steps:
62+
- uses: actions/download-artifact@v2
63+
with:
64+
name: artifact
65+
path: dist
66+
- uses: pypa/gh-action-pypi-publish@master
67+
with:
68+
user: ${{ secrets.PYPI_API_USER }}
69+
password: ${{ secrets.PYPI_API_PASSWORD }}
70+
repository_url: ${{ secrets.PYPI_API_URL }}

0 commit comments

Comments
 (0)