Skip to content

Commit b2d561d

Browse files
committed
ci: split publish-to-pypi and push-tag jobs
This way each job only gets the permissions it needs.
1 parent ebc152f commit b2d561d

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.github/workflows/deploy.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,18 @@ jobs:
7070
path: gh-release-notes.md
7171
retention-days: 1
7272

73-
deploy:
73+
publish-to-pypi:
7474
if: github.repository == 'pytest-dev/pytest'
7575
# Need generate-gh-release-notes only for ordering.
7676
# Don't want to release to PyPI if generating GitHub release notes fails.
7777
needs: [package, generate-gh-release-notes]
78+
needs: [package]
7879
runs-on: ubuntu-latest
7980
environment: deploy
8081
timeout-minutes: 30
8182
permissions:
8283
id-token: write
83-
contents: write
8484
steps:
85-
- uses: actions/checkout@v5
86-
with:
87-
persist-credentials: true
88-
8985
- name: Download Package
9086
uses: actions/download-artifact@v6
9187
with:
@@ -97,6 +93,18 @@ jobs:
9793
with:
9894
attestations: true
9995

96+
push-tag:
97+
needs: [publish-to-pypi]
98+
runs-on: ubuntu-latest
99+
timeout-minutes: 10
100+
permissions:
101+
contents: write
102+
steps:
103+
- uses: actions/checkout@v5
104+
with:
105+
fetch-depth: 0
106+
persist-credentials: true
107+
100108
- name: Push tag
101109
env:
102110
VERSION: ${{ github.event.inputs.version }}
@@ -107,7 +115,7 @@ jobs:
107115
git push origin "$VERSION"
108116
109117
create-github-release:
110-
needs: [generate-gh-release-notes, deploy]
118+
needs: [push-tag, generate-gh-release-notes]
111119
runs-on: ubuntu-latest
112120
timeout-minutes: 10
113121
permissions:

RELEASING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Releasing
133133

134134
Both automatic and manual processes described above follow the same steps from this point onward.
135135

136-
#. After all tests pass and the PR has been approved, trigger the ``deploy`` job
136+
#. After all tests pass and the PR has been approved, trigger the ``deploy`` workflow
137137
in https://github.com/pytest-dev/pytest/actions/workflows/deploy.yml, using the ``release-MAJOR.MINOR.PATCH`` branch
138138
as source.
139139

0 commit comments

Comments
 (0)