Skip to content

Commit 95bab86

Browse files
add GitHub Actions workflow for publishing to PyPI
1 parent 0519c98 commit 95bab86

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/publish-pypi.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish to PyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build distribution
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Check out repository
12+
uses: actions/checkout@v6
13+
with:
14+
persist-credentials: false
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v6
18+
with:
19+
python-version: "3.*"
20+
21+
- name: Install build tooling
22+
run: python -m pip install --upgrade pip build twine
23+
24+
- name: Build distributions
25+
run: python -m build
26+
27+
- name: Check distributions
28+
run: python -m twine check dist/*
29+
30+
- name: Upload distribution artifacts
31+
uses: actions/upload-artifact@v6
32+
with:
33+
name: python-package-distributions
34+
path: dist/
35+
36+
publish:
37+
name: Publish to PyPI
38+
if: startsWith(github.ref, 'refs/tags/')
39+
40+
needs: build
41+
runs-on: ubuntu-latest
42+
43+
environment:
44+
name: pypi
45+
url: https://pypi.org/p/open-earable-python
46+
permissions:
47+
id-token: write
48+
steps:
49+
- name: Download distribution artifacts
50+
uses: actions/download-artifact@v6
51+
with:
52+
name: python-package-distributions
53+
path: dist/
54+
55+
- name: Publish to PyPI
56+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)