Skip to content

Commit ac9b431

Browse files
committed
Add publish pypi action
1 parent b458378 commit ac9b431

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/publish.yml

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

0 commit comments

Comments
 (0)