Skip to content

Commit 7471dee

Browse files
authored
Add auto-publish to PyPi workflow (#333)
1 parent 0ca7fdd commit 7471dee

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/pypi-publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
publish:
10+
description: "Publish to PyPI publish"
11+
required: false
12+
default: false
13+
type: boolean
14+
15+
jobs:
16+
pypi-publish:
17+
name: Upload release to PyPI
18+
runs-on: ubuntu-latest
19+
# Specifying a GitHub environment is optional, but strongly encouraged
20+
# environment: pypi
21+
permissions:
22+
# IMPORTANT: this permission is mandatory for Trusted Publishing
23+
id-token: write
24+
steps:
25+
- uses: actions/checkout@v6
26+
27+
- uses: actions/setup-python@v6
28+
with:
29+
python-version: "3.14"
30+
31+
- name: Install build tool
32+
run: pip install build
33+
34+
# Create wheel and source dist
35+
- name: Build
36+
run: python -m build
37+
38+
- name: Publish package to PyPI
39+
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish) }}
40+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)