-
Notifications
You must be signed in to change notification settings - Fork 15
101 lines (84 loc) · 2.61 KB
/
publish.yml
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
# This workflow is triggered by a new release on GitHub and then uploads
# MulensModel package to PyPI.
name: Upload Python Package to PyPI
on:
release:
types: [published]
workflow_dispatch:
inputs:
disable-publish:
description: |
Disables publish to PyPA (default, true for manual runs). Artifacts are
available in both cases.
default: true
type: boolean
jobs:
build_wheels:
name: ${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # If false, continue with other matrix even if one fails
matrix:
# A matrix of OSs, Python verisons, and architectures
# Skips PyPy
os: [ubuntu-latest, macos-latest]
cibw_archs: [auto64, arm64]
cibw_build: [cp38-*, cp39-*, cp310-*, cp311-*]
cibw_skip: [pp*]
exclude:
- os: ubuntu-latest
cibw_archs: "arm64"
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_SKIP: ${{ matrix.cibw_skip }}
- uses: actions/upload-artifact@v4
with:
name: wheelhouse-${{ matrix.os }}-${{ matrix.cibw_archs }}-${{ matrix.cibw_build }}
path: ./wheelhouse/*.whl
build_source:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python setup.py sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/*.tar.gz
publish:
name: Publish to PyPI
if: ${{ !(inputs.disable-publish || false) }} # Only skips if inputs.disable-publish is true
runs-on: ubuntu-latest
needs: [build_source, build_wheels]
steps:
- uses: actions/checkout@v4
- name: Download sdist artifacts to dist/
uses: actions/[email protected]
with:
name: sdist
path: dist/
- name: Download wheelhouse artifacts to dist/
uses: actions/[email protected]
with:
name: wheelhouse
path: dist/
- name: Publish package to PyPI
# All files in dist/ are published
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}