@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 03:37 UTC

next
yml 492 lines 20.7 KB
Raw
1 name: SDK release
2 run-name: SDK release (${{ github.event_name }}, ${{ github.actor }})
3
4 # One release, three stages, each started by its own event. scripts/sdk-release/state.ts lists
5 # the states every stage can end in; each stage's last job shows that state on the request issue.
6 # 1. request a ComposioHQ member opens an `[SDK release]` issue or dispatches this workflow;
7 # the bot plans versions on protected next and opens one release PR.
8 # sdk.release.candidates.yml builds and smoke-tests the files on the release PR;
9 # an eligible repository writer approves, and a person merges.
10 # 2. review when the release PR closes, the bot re-checks approval and checks, then tags the
11 # reviewed head. A PR closed without merging is abandoned. A `regate` dispatch
12 # from next re-runs that gate, as next has it now, for a merged release that a
13 # since-fixed gate bug left untagged.
14 # 3. publish the tag run uploads the reviewed files to npm and PyPI, then opens a docs PR
15 # that pins the released versions so twoslash checks against them.
16
17 on:
18 issues:
19 types: [opened]
20 workflow_dispatch:
21 inputs:
22 action:
23 description: request plans a release; regate re-checks and tags the merged, untagged release on next
24 type: choice
25 options: [request, regate]
26 default: request
27 channel:
28 description: stable consumes the changesets; beta publishes a preview to npm next
29 type: choice
30 options: [stable, beta]
31 default: stable
32 typescript:
33 description: TypeScript bump (auto follows the changesets)
34 type: choice
35 options: [auto, patch, minor, major, skip]
36 default: auto
37 python:
38 description: Python bump (auto follows the changesets)
39 type: choice
40 options: [auto, patch, minor, major, skip]
41 default: auto
42 # The tag job checks out the base commit, never the PR, and its gate only reads the PR.
43 pull_request_target: # zizmor: ignore[dangerous-triggers]
44 branches: [next]
45 types: [closed]
46 push:
47 tags: ['sdk-release/*']
48
49 permissions:
50 contents: read
51
52 jobs:
53 # 1. request ---------------------------------------------------------------------------------
54
55 plan:
56 if: >-
57 github.repository == 'ComposioHQ/composio' && github.ref == 'refs/heads/next' &&
58 ((github.event_name == 'workflow_dispatch' && inputs.action == 'request') ||
59 (github.event_name == 'issues' && startsWith(github.event.issue.title, '[SDK release]')))
60 runs-on: ubuntu-latest
61 timeout-minutes: 15
62 environment: sdk-release-control
63 # Queued, not replaced: a newer request never cancels one that is already waiting.
64 concurrency:
65 group: sdk-release-controller
66 queue: max
67 outputs:
68 batch: ${{ steps.plan.outputs.batch }}
69 issue: ${{ steps.plan.outputs.issue }}
70 state: ${{ steps.plan.outputs.state }}
71 steps:
72 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
73 with:
74 persist-credentials: false
75 - uses: ./.github/actions/setup-node-pnpm-bun
76 - run: pnpm install --frozen-lockfile --ignore-scripts
77 # A dedicated release App, installed with only the permissions the runbook lists.
78 - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # zizmor: ignore[github-app]
79 id: app
80 with:
81 client-id: ${{ vars.SDK_RELEASE_APP_CLIENT_ID }}
82 private-key: ${{ secrets.SDK_RELEASE_APP_PRIVATE_KEY }}
83 owner: ComposioHQ
84 repositories: composio
85 - name: Check membership and plan versions
86 id: plan
87 env:
88 SDK_RELEASE_TOKEN: ${{ steps.app.outputs.token }}
89 SDK_RELEASE_APP_SLUG: ${{ vars.SDK_RELEASE_APP_SLUG }}
90 run: bun scripts/sdk-release/batch.ts plan
91
92 # Runs the docs generators, which install third-party packages, so it gets no credentials.
93 prepare:
94 needs: plan
95 if: needs.plan.outputs.batch != ''
96 runs-on: ubuntu-latest
97 timeout-minutes: 30
98 steps:
99 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
100 with:
101 persist-credentials: false
102 - uses: ./.github/actions/setup-node-pnpm-bun
103 - uses: ./.github/actions/setup-python-uv
104 with:
105 cache-dependency-glob: |
106 uv.lock
107 pyproject.toml
108 mise.lock
109 python/pyproject.toml
110 - run: pnpm install --frozen-lockfile --ignore-scripts
111 - working-directory: docs
112 run: bun install --frozen-lockfile --ignore-scripts
113 - name: Apply versions, changelogs and SDK reference docs
114 env:
115 SDK_RELEASE_BATCH: ${{ needs.plan.outputs.batch }}
116 run: bun scripts/sdk-release/prepare.ts /tmp/sdk-release-patch.json
117 - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
118 with:
119 name: sdk-release-patch
120 path: /tmp/sdk-release-patch.json
121 retention-days: 7
122 if-no-files-found: error
123
124 release-pr:
125 needs: [plan, prepare]
126 runs-on: ubuntu-latest
127 timeout-minutes: 15
128 environment: sdk-release-control
129 outputs:
130 state: ${{ steps.open.outputs.state }}
131 # Queued, not replaced: a newer request never cancels one that is already waiting.
132 concurrency:
133 group: sdk-release-controller
134 queue: max
135 steps:
136 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
137 with:
138 persist-credentials: false
139 - uses: ./.github/actions/setup-node-pnpm-bun
140 - run: pnpm install --frozen-lockfile --ignore-scripts
141 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
142 with:
143 name: sdk-release-patch
144 path: /tmp/sdk-release
145 # A dedicated release App, installed with only the permissions the runbook lists.
146 - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # zizmor: ignore[github-app]
147 id: app
148 with:
149 client-id: ${{ vars.SDK_RELEASE_APP_CLIENT_ID }}
150 private-key: ${{ secrets.SDK_RELEASE_APP_PRIVATE_KEY }}
151 owner: ComposioHQ
152 repositories: composio
153 # The batch comes from the plan job's output, which the credential-free prepare job
154 # cannot change; the patch is checked against it before anything is committed.
155 - name: Check the release-only diff and open the release PR
156 id: open
157 env:
158 SDK_RELEASE_TOKEN: ${{ steps.app.outputs.token }}
159 SDK_RELEASE_BATCH: ${{ needs.plan.outputs.batch }}
160 run: bun scripts/sdk-release/batch.ts release-pr /tmp/sdk-release/sdk-release-patch.json
161
162 request-status:
163 needs: [plan, prepare, release-pr]
164 if: always() && needs.plan.result != 'skipped'
165 runs-on: ubuntu-latest
166 timeout-minutes: 5
167 permissions:
168 contents: read
169 issues: write
170 steps:
171 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
172 with:
173 persist-credentials: false
174 - uses: ./.github/actions/setup-node-pnpm-bun
175 - run: pnpm install --frozen-lockfile --ignore-scripts
176 - name: Show the request outcome on the request issue
177 env:
178 GITHUB_TOKEN: ${{ github.token }}
179 RESULTS: >-
180 {"plan": "${{ needs.plan.result }}", "prepare": "${{ needs.prepare.result }}",
181 "release-pr": "${{ needs.release-pr.result }}"}
182 OUTCOME: ${{ needs.release-pr.outputs.state || needs.plan.outputs.state }}
183 ISSUE: ${{ needs.plan.outputs.issue }}
184 run: bun scripts/sdk-release/report.ts status request
185
186 # 3. tag -------------------------------------------------------------------------------------
187
188 # Runs next as it was before this merge, so the merged release PR cannot change the gate.
189 # Every release-PR closure runs it: an unmerged PR is recorded as abandoned.
190 tag:
191 if: >-
192 github.repository == 'ComposioHQ/composio' && github.event_name == 'pull_request_target' &&
193 startsWith(github.event.pull_request.head.ref, 'sdk-release/batch-')
194 runs-on: ubuntu-latest
195 timeout-minutes: 15
196 environment: sdk-release-control
197 # Shared with regate, so a re-gate and a closing release PR never tag at the same time.
198 concurrency:
199 group: sdk-release-tag
200 queue: max
201 outputs:
202 issue: ${{ steps.tag.outputs.issue }}
203 state: ${{ steps.tag.outputs.state }}
204 steps:
205 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
206 with:
207 ref: ${{ github.event.pull_request.base.sha }}
208 persist-credentials: false
209 - uses: ./.github/actions/setup-node-pnpm-bun
210 - run: pnpm install --frozen-lockfile --ignore-scripts
211 # A dedicated release App, installed with only the permissions the runbook lists.
212 - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # zizmor: ignore[github-app]
213 id: app
214 with:
215 client-id: ${{ vars.SDK_RELEASE_APP_CLIENT_ID }}
216 private-key: ${{ secrets.SDK_RELEASE_APP_PRIVATE_KEY }}
217 owner: ComposioHQ
218 repositories: composio
219 - name: Check approval and candidate checks, then tag the reviewed head
220 id: tag
221 env:
222 SDK_RELEASE_TOKEN: ${{ steps.app.outputs.token }}
223 SDK_RELEASE_APP_SLUG: ${{ vars.SDK_RELEASE_APP_SLUG }}
224 run: bun scripts/sdk-release/batch.ts tag
225
226 # Recovers a merged release that a gate bug left untagged, once the fix is on next. It finds the
227 # release from the untagged plan on next, so it cannot be pointed at another PR or commit, and
228 # applies the same gate. The new tag's push starts publishing as usual.
229 regate:
230 if: >-
231 github.repository == 'ComposioHQ/composio' && github.event_name == 'workflow_dispatch' &&
232 inputs.action == 'regate' && github.ref == 'refs/heads/next'
233 runs-on: ubuntu-latest
234 timeout-minutes: 15
235 environment: sdk-release-control
236 concurrency:
237 group: sdk-release-tag
238 queue: max
239 outputs:
240 issue: ${{ steps.regate.outputs.issue }}
241 state: ${{ steps.regate.outputs.state }}
242 steps:
243 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
244 with:
245 persist-credentials: false
246 - uses: ./.github/actions/setup-node-pnpm-bun
247 - run: pnpm install --frozen-lockfile --ignore-scripts
248 # A dedicated release App, installed with only the permissions the runbook lists.
249 - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # zizmor: ignore[github-app]
250 id: app
251 with:
252 client-id: ${{ vars.SDK_RELEASE_APP_CLIENT_ID }}
253 private-key: ${{ secrets.SDK_RELEASE_APP_PRIVATE_KEY }}
254 owner: ComposioHQ
255 repositories: composio
256 - name: Re-check the merged release on next, then tag its reviewed head
257 id: regate
258 env:
259 SDK_RELEASE_TOKEN: ${{ steps.app.outputs.token }}
260 SDK_RELEASE_APP_SLUG: ${{ vars.SDK_RELEASE_APP_SLUG }}
261 run: bun scripts/sdk-release/batch.ts regate
262
263 review-status:
264 needs: [tag, regate]
265 if: always() && (needs.tag.result != 'skipped' || needs.regate.result != 'skipped')
266 runs-on: ubuntu-latest
267 timeout-minutes: 5
268 permissions:
269 contents: read
270 issues: write
271 steps:
272 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
273 with:
274 ref: ${{ github.event.pull_request.base.sha || github.sha }}
275 persist-credentials: false
276 - uses: ./.github/actions/setup-node-pnpm-bun
277 - run: pnpm install --frozen-lockfile --ignore-scripts
278 - name: Show the review outcome on the request issue
279 env:
280 GITHUB_TOKEN: ${{ github.token }}
281 RESULTS: '{"tag": "${{ needs.tag.result }}", "regate": "${{ needs.regate.result }}"}'
282 OUTCOME: ${{ needs.tag.outputs.state || needs.regate.outputs.state }}
283 ISSUE: ${{ needs.tag.outputs.issue || needs.regate.outputs.issue }}
284 run: bun scripts/sdk-release/report.ts status review
285
286 # 3. publish ---------------------------------------------------------------------------------
287
288 # Pins the release-PR artifacts once by ID and digest. "Re-run failed jobs" keeps this
289 # output, so every attempt publishes the same reviewed bytes.
290 candidates:
291 if: github.repository == 'ComposioHQ/composio' && startsWith(github.ref, 'refs/tags/sdk-release/')
292 runs-on: ubuntu-latest
293 timeout-minutes: 15
294 permissions:
295 contents: read
296 actions: read
297 outputs:
298 approved: ${{ steps.approve.outputs.approved }}
299 typescript: ${{ steps.approve.outputs.typescript }}
300 python: ${{ steps.approve.outputs.python }}
301 issue: ${{ steps.approve.outputs.issue }}
302 steps:
303 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
304 with:
305 persist-credentials: false
306 - uses: ./.github/actions/setup-node-pnpm-bun
307 with:
308 enable-caching: 'false'
309 - run: pnpm install --frozen-lockfile --ignore-scripts
310 - name: Pin the approved release-PR candidates
311 id: approve
312 env:
313 SDK_READ_TOKEN: ${{ github.token }}
314 SDK_RELEASE_APP_SLUG: ${{ vars.SDK_RELEASE_APP_SLUG }}
315 run: bun scripts/sdk-release/candidates.ts approve
316
317 publish-npm:
318 needs: candidates
319 if: needs.candidates.outputs.typescript == 'true'
320 runs-on: ubuntu-latest
321 # Room for the 20-minute registry waits after the upload, after the channel tag moves and in
322 # the fresh install, so a wait that runs out names what is missing before the job times out.
323 timeout-minutes: 75
324 environment: npm-release
325 # One npm publisher at a time, so an older retry cannot move `latest` back over a newer release.
326 concurrency:
327 group: sdk-release-npm
328 queue: max
329 permissions:
330 contents: read
331 actions: read
332 id-token: write
333 steps:
334 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
335 with:
336 persist-credentials: false
337 - uses: ./.github/actions/setup-node-pnpm-bun
338 - run: pnpm install --frozen-lockfile --ignore-scripts
339 - name: Pin npm with native dist-tag OIDC support
340 run: npm install --global npm@11.21.0 --ignore-scripts --registry=https://registry.npmjs.org
341 # Checks npm's trusted-publishing login for every planned package before uploading anything.
342 - name: Check the npm login, upload missing npm files, move the channel tag and check their provenance
343 id: publish
344 env:
345 SDK_READ_TOKEN: ${{ github.token }}
346 APPROVED_CANDIDATES: ${{ needs.candidates.outputs.approved }}
347 run: bun scripts/sdk-release/registry.ts publish typescript
348 - name: Check registry signatures on a fresh install, as a user would
349 env:
350 SPECS: ${{ steps.publish.outputs.specs }}
351 WAIT_SECONDS: ${{ steps.publish.outputs.wait_seconds }}
352 run: |
353 cd "$(mktemp -d)"
354 npm init --yes > /dev/null
355 # The registry CDN can serve a stale package document after npm's publish-time scan, so
356 # the install revalidates and retries for as long as the registry wait in registry-wait.ts.
357 # shellcheck disable=SC2086 # one argument per package
358 until npm install --prefer-online --ignore-scripts --registry=https://registry.npmjs.org $SPECS; do
359 if [ "$SECONDS" -ge "$WAIT_SECONDS" ]; then
360 echo "::error::npm still does not install $SPECS after ${SECONDS}s"
361 exit 1
362 fi
363 echo "npm install failed after ${SECONDS}s; retrying in 30 seconds"
364 sleep 30
365 done
366 npm audit signatures
367
368 publish-pypi:
369 needs: candidates
370 if: needs.candidates.outputs.python == 'true'
371 runs-on: ubuntu-latest
372 timeout-minutes: 30
373 environment: pypi-release
374 permissions:
375 contents: read
376 actions: read
377 id-token: write
378 steps:
379 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
380 with:
381 persist-credentials: false
382 - uses: ./.github/actions/setup-node-pnpm-bun
383 - run: pnpm install --frozen-lockfile --ignore-scripts
384 - name: Stage the PyPI files that are still missing
385 id: stage
386 env:
387 SDK_READ_TOKEN: ${{ github.token }}
388 APPROVED_CANDIDATES: ${{ needs.candidates.outputs.approved }}
389 run: bun scripts/sdk-release/registry.ts publish python
390 - name: Upload missing PyPI files
391 if: steps.stage.outputs.missing == 'true'
392 uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086
393 with:
394 packages-dir: sdk-publication/missing-python/
395 - name: Wait until PyPI serves every file, then check each attestation's publisher
396 id: verify
397 env:
398 SDK_READ_TOKEN: ${{ github.token }}
399 APPROVED_CANDIDATES: ${{ needs.candidates.outputs.approved }}
400 run: bun scripts/sdk-release/registry.ts verify python
401 - uses: ./.github/actions/setup-python-uv
402 with:
403 enable-caching: 'false'
404 - name: Check the attestation signatures, as a user would
405 env:
406 FILES: ${{ steps.verify.outputs.files }}
407 run: |
408 for url in $FILES; do
409 uvx pypi-attestations==0.0.30 verify pypi \
410 --repository https://github.com/ComposioHQ/composio "$url"
411 done
412
413 # Pins the docs to the released npm versions. It follows the npm job, so a Python-only release,
414 # which skips that job, skips this one too.
415 docs:
416 needs: publish-npm
417 runs-on: ubuntu-latest
418 timeout-minutes: 30
419 permissions:
420 contents: read
421 steps:
422 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
423 with:
424 persist-credentials: false
425 - uses: ./.github/actions/setup-node-pnpm-bun
426 - run: pnpm install --frozen-lockfile --ignore-scripts
427 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
428 with:
429 ref: next
430 path: next
431 persist-credentials: false
432 - name: Pin the docs to the released npm versions
433 run: |
434 # Run report.ts from the root: next/docs/bunfig.toml preloads docs packages that aren't installed here.
435 specs=$(bun scripts/sdk-release/report.ts docs-pins next/docs/package.json)
436 [ -n "$specs" ] || exit 0
437 cd next/docs
438 # The registry CDN can serve a stale package document right after publishing.
439 for attempt in 1 2 3 4 5; do
440 # shellcheck disable=SC2086 # one argument per package
441 bun add --dev --exact --ignore-scripts $specs && exit 0
442 echo "bun add failed (attempt $attempt); retrying in 30 seconds"
443 sleep 30
444 done
445 exit 1
446 # A dedicated release App, installed with only the permissions the runbook lists.
447 - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # zizmor: ignore[github-app]
448 id: app
449 with:
450 client-id: ${{ vars.RELEASE_BOT_CLIENT_ID }}
451 private-key: ${{ secrets.RELEASE_BOT_APP_PRIVATE_KEY }}
452 # Opens nothing when the docs already pin these versions.
453 - name: Open the docs pin PR
454 uses: peter-evans/create-pull-request@3ffccacd46053766916f087ce41d627c0b8cf2d1 # v8.1.3
455 with:
456 token: ${{ steps.app.outputs.token }}
457 path: next
458 base: next
459 branch: docs/${{ github.ref_name }}
460 add-paths: |
461 docs/package.json
462 docs/bun.lock
463 commit-message: 'docs: pin the SDK packages released in ${{ github.ref_name }}'
464 title: 'docs: pin the SDK packages released in ${{ github.ref_name }}'
465 body: |
466 Pins the docs to the npm versions published by ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}, so twoslash type-checks every snippet against the released types.
467
468 Merge after the docs checks pass.
469
470 publish-status:
471 needs: [candidates, publish-npm, publish-pypi, docs]
472 if: always() && needs.candidates.result != 'skipped'
473 runs-on: ubuntu-latest
474 timeout-minutes: 5
475 permissions:
476 contents: read
477 issues: write
478 steps:
479 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
480 with:
481 persist-credentials: false
482 - uses: ./.github/actions/setup-node-pnpm-bun
483 - run: pnpm install --frozen-lockfile --ignore-scripts
484 - name: Show the publication outcome on the request issue
485 env:
486 GITHUB_TOKEN: ${{ github.token }}
487 RESULTS: >-
488 {"candidates": "${{ needs.candidates.result }}",
489 "publish-npm": "${{ needs.publish-npm.result }}",
490 "publish-pypi": "${{ needs.publish-pypi.result }}", "docs": "${{ needs.docs.result }}"}
491 ISSUE: ${{ needs.candidates.outputs.issue }}
492 run: bun scripts/sdk-release/report.ts status publish