Skip to content

Commit c685693

Browse files
authored
Create publish.yml
Created the github action to publish the package to pypi
1 parent b922df8 commit c685693

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish Python package to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "v*.*.*" # e.g. v0.1.0, v0.1.1
8+
9+
jobs:
10+
build-and-publish:
11+
runs-on: ubuntu-latest
12+
13+
# Required for Trusted Publishing
14+
permissions:
15+
id-token: write
16+
contents: read
17+
18+
# Optional but recommended – must match the PyPI pending publisher
19+
environment: pypi
20+
21+
steps:
22+
- name: Check out source
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.x"
29+
30+
- name: Install build backend
31+
run: |
32+
pip install --upgrade pip
33+
pip install build
34+
35+
- name: Build distributions
36+
run: python -m build
37+
38+
- name: Publish to PyPI (Trusted Publishing)
39+
uses: pypa/gh-action-pypi-publish@release/v1
40+
with:
41+
verbose: true

0 commit comments

Comments
 (0)