Skip to content

Commit a44da20

Browse files
Merge pull request #2 from olly-writes-code/publish-to-pypi
add publish workflow
2 parents 997b49f + 61148f9 commit a44da20

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
### made following this guide: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#workflow-definition
2+
3+
name: Publish to PyPI
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
name: Build Python distribution
12+
### we currently only support macOS and python version 3.13
13+
runs-on: macos-15
14+
strategy:
15+
matrix:
16+
python-version: [3.13]
17+
steps:
18+
- uses: actions/checkout@v5
19+
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v6
22+
with:
23+
### it's best practice to pin the UV version
24+
version: "0.9.5"
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Build the wheel
28+
run: uv build
29+
30+
- name: Store the distribution packages
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: python-package-distributions
34+
path: dist/
35+
36+
publish-to-pypi:
37+
name: Publish Python distribution to PyPI
38+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
39+
needs:
40+
- build
41+
runs-on: ubuntu-latest
42+
environment:
43+
name: pypi
44+
url: https://pypi.org/p/project/pyclipper2/
45+
permissions:
46+
id-token: write # IMPORTANT: mandatory for trusted publishing
47+
48+
steps:
49+
- name: Download all the dists
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: python-package-distributions
53+
path: dist/
54+
- name: Publish distribution to PyPI
55+
uses: pypa/gh-action-pypi-publish@release/v1
56+
57+

0 commit comments

Comments
 (0)