File tree 1 file changed +37
-17
lines changed
1 file changed +37
-17
lines changed Original file line number Diff line number Diff line change 1
- # This workflows will upload a Python Package using Twine when a release is created
2
- # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3
-
4
- name : Upload Python Package
5
-
1
+ name : Publish to PyPI
6
2
on :
7
3
release :
8
- types : [created]
4
+ # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
5
+ types : [released]
6
+ workflow_dispatch :
9
7
10
8
jobs :
11
- deploy :
9
+ test :
10
+ uses : ./.github/workflows/ci.yml
11
+
12
+ build :
13
+ needs : ['test']
12
14
runs-on : ubuntu-latest
13
15
14
16
steps :
15
- - uses : actions/checkout@v2
17
+ - uses : actions/checkout@v4
16
18
- name : Set up Python
17
- uses : actions/setup-python@v2
19
+ uses : actions/setup-python@v4
18
20
with :
19
21
python-version : " 3.x"
20
22
- name : Install dependencies
21
23
run : |
22
24
python -m pip install --upgrade pip
23
- pip install setuptools wheel twine
24
- - name : Build and publish
25
- env :
26
- TWINE_USERNAME : __token__
27
- TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
28
- run : |
29
- python setup.py sdist bdist_wheel
30
- twine upload dist/*
25
+ pip install build
26
+ - name : Build package distributions
27
+ run : python -m build
28
+
29
+ - uses : actions/upload-artifact@v3
30
+ with :
31
+ path : ./dist
32
+
33
+ # https://docs.pypi.org/trusted-publishers/using-a-publisher/
34
+ pypi-publish :
35
+ needs : ['build']
36
+ environment : ' publish'
37
+
38
+ name : Upload release to PyPI
39
+ runs-on : ubuntu-latest
40
+ permissions :
41
+ # Mandatory for trusted publishing
42
+ id-token : write
43
+ steps :
44
+ - uses : actions/download-artifact@v3
45
+
46
+ - name : Publish package distributions to PyPI
47
+ uses : pypa/gh-action-pypi-publish@release/v1
48
+ with :
49
+ packages-dir : artifact/
50
+ print-hash : true
You can’t perform that action at this time.
0 commit comments