Skip to content

Commit e5c9065

Browse files
committed
Use GitHub Actions to publish releases to PyPI.
1 parent 3a9e746 commit e5c9065

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
name: publish
3+
4+
on:
5+
push:
6+
tags: ['[0-9]+.[0-9]+']
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
14+
- uses: actions/checkout@v5
15+
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version-file: 'pyproject.toml'
19+
20+
- run: pip install build
21+
- run: python3 -m build
22+
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
path: dist
26+
27+
create-release:
28+
needs: [build]
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: write
32+
33+
steps:
34+
35+
- uses: actions/download-artifact@v4
36+
37+
- name: create release
38+
run: >-
39+
gh release create --draft
40+
--repo ${{ github.repository }}
41+
${{ github.ref_name }}
42+
artifact/*
43+
env:
44+
GH_TOKEN: ${{ github.token }}
45+
46+
publish-pypi:
47+
needs: [build]
48+
runs-on: ubuntu-latest
49+
permissions:
50+
id-token: write
51+
52+
environment:
53+
name: pypi
54+
url: https://pypi.org/project/${{ github.event.repository.name }}/${{ github.ref_name }}
55+
56+
steps:
57+
58+
- uses: actions/download-artifact@v4
59+
60+
- uses: pypa/gh-action-pypi-publish@release/v1
61+
with:
62+
packages-dir: artifact/

0 commit comments

Comments
 (0)