@@ -68,45 +68,36 @@ jobs:
68
68
run : |
69
69
python -m sphinx -b doctest docs build
70
70
71
- - name : Build artifacts
72
- run : |
73
- python setup.py sdist bdist_wheel
74
-
75
- - name : Upload artifact
76
- uses : actions/upload-artifact@v4
77
- with :
78
- name : ${{ runner.os }}-py${{ matrix.python-version }}-artifact
79
- path : dist/*
80
- retention-days : 7
81
71
82
72
release :
73
+ if : startsWith(github.ref, 'refs/tags/v')
83
74
needs : [build]
84
75
runs-on : ubuntu-latest
76
+ permissions :
77
+ id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
85
78
steps :
86
- - uses : actions/checkout@v2
79
+ - uses : actions/checkout@v4
87
80
88
- - uses : actions/download-artifact@v4.1.7
81
+ - name : Set up Python
82
+ uses : actions/setup-python@v5
89
83
with :
90
- path : artifacts/
84
+ python-version : " 3.10"
85
+
86
+ - name : Install dependencies
87
+ run : |
88
+ pip install -r requirements.txt
89
+ pip install -r dev-requirements.txt
91
90
92
91
- name : Create release description
93
92
run : |
94
93
python release-description.py CHANGELOG.rst > description.md
95
94
cat description.md
96
95
97
- - name : Move artifacts
96
+ - name : Create source distribution
98
97
run : |
99
- ls --recursive artifacts/
100
-
101
- mkdir dist
102
- mv --backup=numbered artifacts/*/** dist
103
- rm -f dist/*~
104
-
105
- echo "To be uploaded:"
106
- ls dist
98
+ python setup.py sdist
107
99
108
100
- name : Create release
109
- if : startsWith(github.ref, 'refs/tags/v')
110
101
uses : softprops/action-gh-release@v1
111
102
env :
112
103
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -115,9 +106,8 @@ jobs:
115
106
files : |
116
107
dist/*
117
108
109
+ # Github Actions have been set as a trusted publisher on PyPI's npstreams project,
110
+ # hence why no username, password, or token is required.
118
111
- name : Upload to PyPI
119
- if : startsWith(github.ref, 'refs/tags/v' )
112
+ if : always( )
120
113
uses : pypa/gh-action-pypi-publish@release/v1
121
- with :
122
- user : __token__
123
- password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments