Skip to content

Commit 47c1581

Browse files
Configure trusted publishing to PyPi
1 parent 7a955e0 commit 47c1581

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,34 +75,27 @@ jobs:
7575
runs-on: ubuntu-latest
7676
needs: [test, build]
7777
if: success() && startsWith(github.ref, 'refs/tags/v')
78+
environment:
79+
name: pypi
80+
url: https://pypi.org/p/patchdiff
81+
permissions:
82+
id-token: write
83+
contents: write
7884
steps:
7985
- uses: actions/checkout@v5
8086
- name: Download wheel artifact
8187
uses: actions/download-artifact@v4
8288
with:
8389
name: dist
8490
path: dist
85-
- name: Get version from git ref
86-
id: get_version
87-
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
88-
- name: Create GH release
89-
uses: actions/create-release@v1
90-
env:
91-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
- name: Release
92+
uses: softprops/action-gh-release@v2
9293
with:
93-
tag_name: ${{ steps.get_version.outputs.VERSION }}
94-
release_name: Release ${{ steps.get_version.outputs.VERSION }}
95-
draft: false
94+
token: ${{ secrets.GITHUB_TOKEN }}
95+
files: |
96+
dist/*.tar.gz
97+
dist/*.whl
98+
draft: true
9699
prerelease: false
97-
- name: Upload release assets
98-
# Move back to official action after fix https://github.com/actions/upload-release-asset/issues/4
99-
uses: AButler/[email protected]
100-
with:
101-
release-tag: ${{ steps.get_version.outputs.VERSION }}
102-
files: 'dist/*.tar.gz;dist/*.whl'
103-
repo-token: ${{ secrets.GITHUB_TOKEN }}
104100
- name: Publish to PyPI
105-
uses: pypa/gh-action-pypi-publish@master
106-
with:
107-
user: __token__
108-
password: ${{ secrets.PYPI_PASSWORD }}
101+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)