Skip to content

Commit a250954

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 a250954

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ 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.
@@ -80,12 +80,7 @@ jobs:
8080
timeout-minutes: 30
8181
permissions:
8282
id-token: write
83-
contents: write
8483
steps:
85-
- uses: actions/checkout@v5
86-
with:
87-
persist-credentials: true
88-
8984
- name: Download Package
9085
uses: actions/download-artifact@v6
9186
with:
@@ -97,6 +92,18 @@ jobs:
9792
with:
9893
attestations: true
9994

95+
push-tag:
96+
needs: [publish-to-pypi]
97+
runs-on: ubuntu-latest
98+
timeout-minutes: 10
99+
permissions:
100+
contents: write
101+
steps:
102+
- uses: actions/checkout@v5
103+
with:
104+
fetch-depth: 0
105+
persist-credentials: true
106+
100107
- name: Push tag
101108
env:
102109
VERSION: ${{ github.event.inputs.version }}
@@ -107,7 +114,7 @@ jobs:
107114
git push origin "$VERSION"
108115
109116
create-github-release:
110-
needs: [generate-gh-release-notes, deploy]
117+
needs: [push-tag, generate-gh-release-notes]
111118
runs-on: ubuntu-latest
112119
timeout-minutes: 10
113120
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)