Skip to content

Commit 9f9ec5b

Browse files
committed
Migrate PyPi publishing to Trusted Puyblishers and environments
1 parent 955e53d commit 9f9ec5b

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

.github/workflows/build-ddev.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,9 @@ jobs:
579579

580580
permissions:
581581
contents: write
582+
id-token: write
583+
584+
environment: pypi-ddev
582585

583586
steps:
584587
- name: Download Python artifacts
@@ -605,8 +608,6 @@ jobs:
605608
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
606609
with:
607610
skip-existing: true
608-
user: __token__
609-
password: ${{ secrets.PYPI_TOKEN_DDEV_2 }}
610611

611612
- name: Add assets to current release
612613
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2

.github/workflows/claim-pypi-name.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
name: Build wheel
2222
runs-on: ubuntu-latest
2323

24+
environment: typo-squatting-release
25+
2426
steps:
2527
- name: Checkout code
2628
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -46,4 +48,4 @@ jobs:
4648
# Only uploading the missing wheels makes this job idempotent and reduces its complexity.
4749
skip-existing: true
4850
user: __token__
49-
password: ${{ secrets.INTEGRATIONS_PYPI_NAME_CLAIM }}
51+
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/release-base.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ jobs:
99
release:
1010
runs-on: ubuntu-latest
1111

12+
permissions:
13+
id-token: write
14+
15+
environment: pypi-datadog-checks-base
16+
1217
steps:
1318
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1419

@@ -30,8 +35,11 @@ jobs:
3035
ddev config set repos.core .
3136
ddev config set repo core
3237
33-
- name: Release base package
34-
run: ddev release upload -s datadog_checks_base
35-
env:
36-
TWINE_USERNAME: __token__
37-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_BASE_2 }}
38+
- name: Build base package
39+
run: ddev release build datadog_checks_base
40+
41+
- name: Release base package to PyPI
42+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
43+
with:
44+
skip-existing: true
45+
packages-dir: datadog_checks_base/dist

.github/workflows/release-dev.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ jobs:
99
release:
1010
runs-on: ubuntu-latest
1111

12+
permissions:
13+
id-token: write
14+
15+
environment: pypi-datadog-checks-dev
16+
1217
steps:
1318
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1419

@@ -30,8 +35,11 @@ jobs:
3035
ddev config set repos.core .
3136
ddev config set repo core
3237
33-
- name: Release dev package
34-
run: ddev release upload -s datadog_checks_dev
35-
env:
36-
TWINE_USERNAME: __token__
37-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_DEV_2 }}
38+
- name: Build dev package
39+
run: ddev release build datadog_checks_dev
40+
41+
- name: Release dev package to PyPI
42+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
43+
with:
44+
skip-existing: true
45+
packages-dir: datadog_checks_dev/dist

0 commit comments

Comments
 (0)