File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build & Publish
2+
3+ on :
4+ pull_request :
5+ branches : [main]
6+
7+ release :
8+ types : [published]
9+
10+ permissions : {}
11+
12+ jobs :
13+ python-build :
14+ name : Python Build
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read # Required to checkout the repository.
18+ steps :
19+ - name : Checkout
20+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
21+ with :
22+ persist-credentials : false
23+
24+ - name : Setup Python
25+ uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
26+ with :
27+ python-version-file : .python-version
28+
29+ - name : Install dependecies
30+ run : python -m pip install --upgrade pip build
31+
32+ - name : Generate distributions
33+ run : python -m build
34+
35+ - name : Upload artifact
36+ id : upload-artifact
37+ if : github.event_name == 'release' && github.event.action == 'published'
38+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
39+ with :
40+ name : python-package-dist
41+ path : dist
42+
43+ outputs :
44+ artifact-uploaded : ${{ steps.upload-artifact.outcome == 'success' }}
45+
46+ pypi-publish :
47+ name : PyPI Publish
48+ needs : python-build
49+ if : needs.python-build.outputs.artifact-uploaded == 'true'
50+ runs-on : ubuntu-latest
51+ environment : pypi
52+ permissions :
53+ id-token : write # Required for PyPI Trusted Publishing.
54+ steps :
55+ - name : Download artifact
56+ uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
57+ with :
58+ name : python-package-dist
59+ path : dist
60+
61+ - name : Publish to PyPI
62+ uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
You can’t perform that action at this time.
0 commit comments