Skip to content

Commit 5512bf2

Browse files
cdce8pPierre-Sassoulas
authored andcommitted
Update release workflow to use Trusted Publishing (#2696)
1 parent aad8e68 commit 5512bf2

File tree

2 files changed

+51
-12
lines changed

2 files changed

+51
-12
lines changed

Diff for: .github/workflows/release.yml

+47-12
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ permissions:
1212
contents: read
1313

1414
jobs:
15-
release-pypi:
16-
name: Upload release to PyPI
15+
build:
16+
name: Build release assets
1717
runs-on: ubuntu-latest
18-
environment:
19-
name: PyPI
20-
url: https://pypi.org/project/astroid/
18+
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
2119
steps:
2220
- name: Check out code from Github
2321
uses: actions/[email protected]
@@ -31,15 +29,52 @@ jobs:
3129
run: |
3230
# Remove dist, build, and astroid.egg-info
3331
# when building locally for testing!
34-
python -m pip install twine build
32+
python -m pip install build
3533
- name: Build distributions
3634
run: |
3735
python -m build
36+
- name: Upload release assets
37+
uses: actions/[email protected]
38+
with:
39+
name: release-assets
40+
path: dist/
41+
42+
release-pypi:
43+
name: Upload release to PyPI
44+
runs-on: ubuntu-latest
45+
needs: ["build"]
46+
environment:
47+
name: PyPI
48+
url: https://pypi.org/project/astroid/
49+
permissions:
50+
id-token: write
51+
steps:
52+
- name: Download release assets
53+
uses: actions/[email protected]
54+
with:
55+
name: release-assets
56+
path: dist/
3857
- name: Upload to PyPI
3958
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
40-
env:
41-
TWINE_REPOSITORY: pypi
42-
TWINE_USERNAME: __token__
43-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
44-
run: |
45-
twine upload --verbose dist/*
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
61+
release-github:
62+
name: Upload assets to Github release
63+
runs-on: ubuntu-latest
64+
needs: ["build"]
65+
permissions:
66+
contents: write
67+
id-token: write
68+
steps:
69+
- name: Download release assets
70+
uses: actions/[email protected]
71+
with:
72+
name: release-assets
73+
path: dist/
74+
- name: Sign the dists with Sigstore and upload assets to Github release
75+
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
76+
uses: sigstore/[email protected]
77+
with:
78+
inputs: |
79+
./dist/*.tar.gz
80+
./dist/*.whl

Diff for: ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Release date: TBA
1919
Closes #2686
2020
Closes pylint-dev/pylint#8589
2121

22+
* Upload release assets to PyPI via Trusted Publishing.
23+
24+
Refs pylint-dev/pylint#10256
25+
2226

2327
What's New in astroid 3.3.8?
2428
============================

0 commit comments

Comments
 (0)