-
-
Notifications
You must be signed in to change notification settings - Fork 89
54 lines (47 loc) · 1.77 KB
/
publish.yml
File metadata and controls
54 lines (47 loc) · 1.77 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
name: Build and upload to PyPI
on:
# Allow manual triggering of the workflow, but note that the upload
# to PyPI step will not run manual trigger.
workflow_dispatch:
# Run workflow on pullrequests, but note that the upload to PyPI step
# will not run on pull requests.
pull_request:
# Run workflow on push to main branch, but note that the upload to
# PyPI step will not run on pushes. We could change that if we wanted
# to have it publish on tags -- see the upload_pypi job below.
push:
branches:
- main
# Run workflow on GitHub release done through the UI -- this is the only
# time the upload to PyPI step will run.
release:
types:
- published
jobs:
build_wheel_sdist:
name: Build wheel and sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
- name: Build wheel and sdist
run: pipx run build
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2
with:
name: wheel-sdist
path: dist/*
upload_pypi:
needs: [build_wheel_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # 5.0.0
with:
# unpacks all CIBW artifacts into dist/
pattern: wheel-sdist
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0