Skip to content

Commit e4de384

Browse files
authored
Update code.yml for trusted publishing
1 parent 6ec9ecc commit e4de384

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/code.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,13 @@ jobs:
116116
needs: [lint, dist, test]
117117
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
118118
runs-on: ubuntu-latest
119-
env:
120-
HAS_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN != '' }}
119+
permissions:
120+
# this permission is mandatory for trusted publishing To PyPI
121+
id-token: write
122+
# If you also create a GitHub release in the same job then you also need this permission
123+
contents: write
124+
# Specify the GitHub Environment to publish to
125+
environment: release
121126

122127
steps:
123128
- name: Download wheel and lockfiles
@@ -149,5 +154,4 @@ jobs:
149154
- name: Publish to PyPI
150155
if: ${{ env.HAS_PYPI_TOKEN }}
151156
uses: pypa/gh-action-pypi-publish@release/v1
152-
with:
153-
password: ${{ secrets.PYPI_TOKEN }}
157+

0 commit comments

Comments
 (0)