Skip to content

Commit 9e66492

Browse files
committed
Add publish pypi action
1 parent b458378 commit 9e66492

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish release to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
tags:
6+
- '*'
7+
release:
8+
types: [published]
9+
10+
###############################################################################
11+
# ⬇️ Default permissions for the whole workflow: pull code + request OIDC
12+
###############################################################################
13+
permissions:
14+
contents: read # required by gh release download
15+
id-token: write # 🔑 enables token-less “Trusted Publisher” uploads
16+
17+
jobs:
18+
publish-to-pypi:
19+
if: |
20+
(github.event_name == 'release' && github.event.release.prerelease == false) ||
21+
(github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/'))
22+
runs-on: ubuntu-latest
23+
environment: pypi
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: Download release assets
28+
env:
29+
GH_TOKEN: ${{ github.token }}
30+
run: |
31+
gh release download \
32+
"${{ github.event.release.tag_name }}" \
33+
--repo "${{ github.repository }}" \
34+
--dir dist
35+
36+
- name: Publish to PyPI
37+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)