Skip to content

Commit 59fc368

Browse files
committed
ci(pypi): normalize publish workflow EOF newline
1 parent 4045cd6 commit 59fc368

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

.github/workflows/publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release (PyPI)
2+
3+
on:
4+
# Manual run for publishing to PyPI
5+
workflow_dispatch:
6+
# Optional: publish on tag push (vX.Y.Z)
7+
push:
8+
tags: ["v*"]
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
id-token: write # Required for OIDC Trusted Publishing
15+
contents: read
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.11"
22+
23+
- uses: astral-sh/setup-uv@v3
24+
25+
- name: Install deps
26+
run: uv sync --all-extras --dev
27+
28+
- name: Build dists
29+
run: uv run python -m build
30+
31+
- name: Verify tag matches version (only on tag)
32+
if: startsWith(github.ref, 'refs/tags/')
33+
id: get_tag
34+
shell: bash
35+
run: |
36+
TAG="${GITHUB_REF_NAME#v}"
37+
echo "result_tag=$TAG" >> "$GITHUB_OUTPUT"
38+
python - <<'PY'
39+
import sys, tomllib
40+
with open('pyproject.toml', 'rb') as f:
41+
data = tomllib.load(f)
42+
ver = data['project']['version']
43+
if ver != sys.argv[1]:
44+
print(f"Version {ver} != tag {sys.argv[1]}")
45+
raise SystemExit(1)
46+
PY
47+
"$TAG"
48+
49+
- name: Publish distribution 📦 to PyPI (OIDC)
50+
uses: pypa/gh-action-pypi-publish@release/v1
51+
with:
52+
verbose: true

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,15 @@ Workflow file: `.github/workflows/ci.yml`.
7272

7373
## Releasing
7474

75-
- Bump version in `pyproject.toml` using semantic versioning.
76-
- Build artifacts: `make dist`
77-
- Validate: `uv run twine check dist/*`
78-
- Publish to PyPI: `uv run twine upload -r pypi dist/*`
75+
- Preferred: tag-based OIDC publish
76+
- Ensure PyPI Trusted Publisher is configured for this repo.
77+
- Bump version in `pyproject.toml` using semantic versioning.
78+
- Tag and push: `git tag vX.Y.Z && git push origin vX.Y.Z`
79+
- CI will build and publish automatically.
80+
- Manual (fallback):
81+
- Build artifacts: `make dist`
82+
- Validate: `uv run twine check dist/*`
83+
- Publish to PyPI: `uv run twine upload -r pypi dist/*`
7984

8085
After publish, open/refresh the docs PR in the LangChain monorepo to reference the new version if needed. See LangChain’s integration guide for the process: [How to contribute an integration](https://python.langchain.com/docs/contributing/how_to/integrations/#how-to-contribute-an-integration).
8186

0 commit comments

Comments
 (0)