Skip to content

Commit ea13d4f

Browse files
committed
add publishing on pypi workflow
1 parent 96688ea commit ea13d4f

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build and Publish to PyPI
2+
3+
on:
4+
push:
5+
branches: [main, master, lite]
6+
pull_request:
7+
branches: [main, master, lite]
8+
release:
9+
types: [published]
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build_package:
17+
name: Build package
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.10"
25+
26+
- name: Install build tools
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install --upgrade build twine
30+
31+
- name: Build package
32+
run: python -m build
33+
34+
- name: Check package metadata
35+
run: python -m twine check dist/*
36+
37+
- name: Upload artifacts
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: celloracle-lite-dists
41+
path: dist/*
42+
43+
publish_to_pypi:
44+
name: Publish to PyPI
45+
needs: [build_package]
46+
runs-on: ubuntu-latest
47+
if: github.event_name == 'release' && github.event.action == 'published'
48+
environment:
49+
name: pypi
50+
url: https://pypi.org/p/celloracle-lite
51+
permissions:
52+
id-token: write # For trusted publishing
53+
steps:
54+
- uses: actions/setup-python@v5
55+
with:
56+
python-version: "3.10"
57+
58+
- uses: actions/download-artifact@v4
59+
with:
60+
name: celloracle-lite-dists
61+
path: dist
62+
63+
- name: Publish to PyPI
64+
uses: pypa/gh-action-pypi-publish@release/v1
65+
# Uses trusted publishing (OIDC) - no token needed!

0 commit comments

Comments
 (0)