-
Notifications
You must be signed in to change notification settings - Fork 21
45 lines (43 loc) · 1.23 KB
/
pypi_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
# This workflows will upload a Python Package using PyPI's Trusted Publisher feature: https://docs.pypi.org/trusted-publishers/adding-a-publisher/
name: Upload Python Package
on:
release:
types: [created]
jobs:
build-artifacts:
name: Builds wheel artifacts
runs-on: ubuntu-latest
environment: pypi-publish
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build
run: |
python -m pip install --upgrade pip
pip install build
python -m build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
retention-days: 0
pypi-publish:
needs: build-artifacts
name: Upload release to PyPI
runs-on: ubuntu-latest
environment: pypi-publish
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
# retrieve your distributions here
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1