-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (78 loc) · 2.23 KB
/
Copy pathpublish-pypi.yml
File metadata and controls
84 lines (78 loc) · 2.23 KB
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
name: Publish PyPI
on:
workflow_dispatch:
inputs:
repository:
description: Target repository
required: true
default: testpypi
type: choice
options:
- testpypi
- pypi
confirm_testpypi_verified:
description: Confirm TestPyPI install verification was completed before publishing to PyPI
required: false
default: false
type: boolean
permissions:
contents: read
jobs:
build-wheels:
name: Build manylinux wheels
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v5
- uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: --release --out dist
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.target }}
path: dist
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist
publish-testpypi:
name: Upload to TestPyPI
runs-on: ubuntu-latest
needs: [build-wheels, build-sdist]
if: ${{ github.event.inputs.repository == 'testpypi' && secrets.TEST_PYPI_API_TOKEN != '' }}
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
publish-pypi:
name: Upload to PyPI
runs-on: ubuntu-latest
needs: [build-wheels, build-sdist]
if: ${{ github.event.inputs.repository == 'pypi' && github.event.inputs.confirm_testpypi_verified == 'true' && secrets.PYPI_API_TOKEN != '' }}
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}