forked from ag-ui-protocol/ag-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (118 loc) · 5.39 KB
/
Copy pathpublish-python-preview.yml
File metadata and controls
142 lines (118 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Publish Python Preview to TestPyPI
# Triggered when the build workflow completes. Runs in the base repo context,
# so it has access to secrets even for fork PRs. The code executed here comes
# from the base branch, not the fork — only the built wheel artifacts come
# from the fork's workflow run.
on:
workflow_run:
workflows: ["Build Python Preview"]
types: [completed]
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
environment: pypi
permissions:
actions: read
pull-requests: write
steps:
- name: Download dist artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-preview-dist
path: dist-preview/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- name: Download PR metadata
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-preview-metadata
path: pr-metadata/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- name: Read PR metadata
id: meta
run: |
echo "pr-number=$(cat pr-metadata/pr-number)" >> "$GITHUB_OUTPUT"
echo "version=$(cat pr-metadata/version)" >> "$GITHUB_OUTPUT"
echo "sha=$(cat pr-metadata/sha)" >> "$GITHUB_OUTPUT"
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
version: ">=0.8.0"
- name: Publish all packages to TestPyPI
run: |
echo "Publishing artifacts:"
ls -1 dist-preview/
uv publish \
--publish-url https://test.pypi.org/legacy/ \
--check-url https://test.pypi.org/simple/ \
dist-preview/*
env:
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
- name: Find existing preview comment
if: always()
id: find-comment
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
with:
issue-number: ${{ steps.meta.outputs.pr-number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- ag-ui-python-preview -->'
- name: Post or update install instructions
if: success()
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ steps.meta.outputs.pr-number }}
edit-mode: replace
body: |
<!-- ag-ui-python-preview -->
## Python Preview Packages
Version `${{ steps.meta.outputs.version }}` published to [TestPyPI](https://test.pypi.org).
> **Warning**: These packages are built from contributor code that may not yet have been vetted for correctness or security. Install at your own risk and do not use in production.
### Install with uv
Add the TestPyPI index to your `pyproject.toml`:
```toml
[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = true
```
Then install the packages you need:
```bash
# Core SDK
uv add 'ag-ui-protocol==${{ steps.meta.outputs.version }}' --index testpypi
# Integrations (each already depends on the matching ag-ui-protocol preview)
uv add 'ag-ui-langgraph==${{ steps.meta.outputs.version }}' --index testpypi
uv add 'ag-ui-crewai==${{ steps.meta.outputs.version }}' --index testpypi
# NOTE: ag-ui-agent-spec depends on pyagentspec (git-only, not on PyPI).
# You will need to install pyagentspec separately from its git repo.
uv add 'ag-ui-agent-spec==${{ steps.meta.outputs.version }}' --index testpypi
uv add 'ag_ui_adk==${{ steps.meta.outputs.version }}' --index testpypi
uv add 'ag_ui_strands==${{ steps.meta.outputs.version }}' --index testpypi
```
### Install with pip
```bash
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
ag-ui-protocol==${{ steps.meta.outputs.version }}
```
> Use `--extra-index-url https://pypi.org/simple/` so pip can resolve
> transitive dependencies (pydantic, fastapi, etc.) from real PyPI.
---
_Commit: ${{ steps.meta.outputs.sha }}_
- name: Post failure comment
if: failure()
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ steps.meta.outputs.pr-number }}
edit-mode: replace
body: |
<!-- ag-ui-python-preview -->
## Python Preview Packages — Publish Failed
Preview publish failed for commit ${{ steps.meta.outputs.sha }}.
See the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.