Skip to content

Commit f4cf73a

Browse files
authored
feat: add GitHub Actions workflow for PyPI publishing and update CI (#4)
* feat: add GitHub Actions workflow for publishing to PyPI on release - Introduced a new workflow that triggers on GitHub releases to automate the publishing of Python packages to PyPI. - Configured steps for checking out the code, setting up Python, installing dependencies, building the package, and publishing it. - Ensures that existing versions on PyPI do not cause failures during the publish process. * chore: update CI workflow to use latest actions versions - Upgraded actions/checkout from v4 to v6 and actions/setup-python from v5 to v6 in the CI configuration. - Ensures compatibility with the latest features and improvements in GitHub Actions. * chore: upgrade actions in CI workflow to latest versions - Updated actions/checkout from v4 to v6 and actions/setup-python from v5 to v6 in the publish-pypi.yml workflow. - Ensures compatibility with the latest features and improvements in GitHub Actions.
1 parent 0af9a55 commit f4cf73a

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
matrix:
1414
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v6
1717
- name: Set up Python
18-
uses: actions/setup-python@v5
18+
uses: actions/setup-python@v6
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121
- name: Install dependencies

.github/workflows/publish-pypi.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Publish to PyPI when a GitHub release is published.
2+
3+
name: Publish to PyPI
4+
5+
on:
6+
release:
7+
types: [published]
8+
9+
permissions:
10+
id-token: write # Required for PyPI trusted publishing (OIDC)
11+
contents: read
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
# Optional: uncomment to use a GitHub environment for approval gates
17+
# environment: pypi
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v6
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v6
24+
with:
25+
python-version: "3.12"
26+
27+
- name: Install build dependencies
28+
run: python -m pip install --upgrade pip build
29+
30+
- name: Build package
31+
run: python -m build
32+
33+
- name: Publish to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
skip-existing: true # Do not fail if this version is already published
37+
verbose: true

0 commit comments

Comments
 (0)