-
Notifications
You must be signed in to change notification settings - Fork 110
59 lines (51 loc) · 1.48 KB
/
publish-to-pypi.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
name: "Build and Publish"
on:
push:
branches: [ develop ]
tags: [ '*' ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
schedule:
- cron: '30 22 15 * *'
jobs:
build:
name: Build Python distributions
runs-on: ubuntu-latest
strategy:
# Matrix to exercise the build backend on all versions of python supported
matrix:
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install pypa/build
run: |
pip install build
python --version
pip list
- name: Build a binary wheel and a source tarball
run: python -m build
- uses: actions/upload-artifact@v4
with:
name: distributions-built-with-py${{ matrix.python }}
path: dist/
publish:
name: "Publish to PyPI"
# Only upload for an actual tag
if: ${{ startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/download-artifact@v4
with:
# Download distributions from one job of the matrix
name: "distributions-built-with-py-3.12"
path: "dist"
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}