Skip to content

Commit 0901e1a

Browse files
Use PyPI OIDC when releasing (#912)
1 parent 6f61f29 commit 0901e1a

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/release.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
build_wheels:
1515
name: Build wheels on Ubuntu latest
1616
runs-on: ubuntu-latest
17+
permissions:
18+
id-token: write
19+
environment: secure_publish_environment
1720
if: github.event_name == 'release' && github.event.action == 'published'
1821
steps:
1922
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
@@ -30,11 +33,12 @@ jobs:
3033
run: |
3134
python -m pip install datadog_checks_dev[cli]==20.0.1
3235
33-
- name: Set ddev pypi credentials
34-
run: |
35-
ddev config set pypi.user __token__
36-
ddev config set pypi.pass ${{ secrets.PYPI_TOKEN }}
37-
38-
- name: Publish the wheel to PyPI
39-
run: |
40-
ddev release upload . --sdist
36+
# Publish wheels to PyPI using Trusted Publishers.
37+
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
38+
# This job needs to run from within the pypi-datadog-checks-base environment. PyPi
39+
# validates the workflow file name, environment and repository the request is
40+
# comming from to provide the valid JWT token.
41+
- name: Release base package to PyPI
42+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
43+
with:
44+
skip-existing: true

0 commit comments

Comments
 (0)