Skip to content

Commit 890bf8a

Browse files
committed
Add PyPI publish workflow for 0.2.3
1 parent 97f0587 commit 890bf8a

4 files changed

Lines changed: 82 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Publish Python package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]*"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
name: Test and build distributions
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.12"
24+
25+
- name: Set up uv
26+
uses: astral-sh/setup-uv@v4
27+
with:
28+
enable-cache: true
29+
30+
- name: Install dependencies
31+
run: uv sync --group test
32+
33+
- name: Run unit tests
34+
run: uv run python -m unittest
35+
36+
- name: Run sixline examples
37+
run: uv run python examples/sixline_example.py
38+
39+
- name: Run bazi examples
40+
run: uv run python examples/bazi_example.py
41+
42+
- name: Build distributions
43+
run: uv build
44+
45+
- name: Upload dists
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
51+
publish:
52+
name: Publish to PyPI
53+
needs: build
54+
runs-on: ubuntu-latest
55+
56+
environment:
57+
name: pypi
58+
url: https://pypi.org/p/divicast
59+
60+
permissions:
61+
contents: read
62+
id-token: write
63+
64+
steps:
65+
- name: Download dists
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: python-package-distributions
69+
path: dist/
70+
71+
- name: Publish distributions to PyPI
72+
uses: pypa/gh-action-pypi-publish@release/v1

CLAUDE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,16 @@ uv run python examples/bazi_example.py
3535
# Build and publish to PyPI
3636

3737
uv cache clean # clean uv cache s
38+
uv sync --group test # refresh uv.lock after pyproject.toml changes and install test deps
39+
uv run python -m unittest
3840
uv build # build source distribution and wheel, outputs to dist/
3941
twine upload dist/* # publish to PyPI, requires ~/.pypirc with PyPI credentials
42+
43+
# GitHub Actions PyPI publishing
44+
# .github/workflows/publish.yml publishes tagged releases like v0.2.2.
45+
# Keep it aligned with CI: uv sync --group test, uv run python -m unittest,
46+
# both examples, then uv build. PyPI should use Trusted Publishing for
47+
# the pypi environment instead of storing an API token secret in GitHub.
4048
```
4149

4250

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "divicast"
3-
version = "0.2.2"
3+
version = "0.2.3"
44
description = "This is a metaphysical chart library, including six line"
55
readme = "README.md"
66
authors = [

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)