Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .claude/skills/release/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
name: release
description: Cut a release of the whole repo - write its section of the root CHANGELOG.md, tag `vX.Y.Z` on main and publish the GitHub release, which publishes the Python packages. Read before tagging a release, or when asked to update CHANGELOG.md. Not for router deploy tags (`accelerate-v*`, the `deploy` skill) or SDK tags (each `sdk-<lang>` skill).
---

# Release

A release is one version of the whole repo: the router, the SDKs, the Python packages and the
apps. It is a tag `vX.Y.Z` on a `main` commit and a GitHub release for that tag. The GitHub
release starts `.github/workflows/release.yml`, which publishes the Python packages to PyPI.
Router deploy tags (`accelerate-v*`) and SDK tags (`sdk-js-v*`, `sdk-kotlin-v*`, `sdk-dotnet-v*`,
`sdk-dart-v*`, `sdks/go/v*`) are not releases here and get no CHANGELOG section.

A version uploaded to PyPI can never be uploaded again. Ask the human before step 5.

## 1. Find the previous release and choose the version

```bash
gh release list -R GetStream/Agents --limit 50 --json tagName,publishedAt \
--jq '[.[] | select(.tagName | test("^v?[0-9]+\\.[0-9]+\\.[0-9]+$"))] | sort_by(.publishedAt) | last | .tagName'
```

This prints the newest release whose tag is a bare version. Tags are `vX.Y.Z`; `0.7.0` is the
one exception, with no `v`. While the version is 0.x, a breaking change bumps the minor and
anything else bumps the patch. No file holds the version: the Python packages read it from the
tag (`sdks/python/pyproject.toml`, `[tool.hatch.version] source = "vcs"`).

## 2. Write the CHANGELOG section in a PR

On a branch from `origin/main`, list what merged since the previous release:

```bash
git log <previous tag>..origin/main --oneline | grep -E '\(#[0-9]+\)$|Merge pull request #[0-9]+ '
```

Do not add `--first-parent`: a PR that reached `main` inside a merge commit (the #2030 accelerate
merge) is not on the first-parent chain, and the list would miss it (#2053). The second pattern
lists a PR merged by a `Merge pull request #N` commit (#2088).

In the root `CHANGELOG.md`:

- Rename `# Unreleased` to `# vX.Y.Z`, and add a new, empty `# Unreleased` above it. For the first
release after `0.7.0` only, add one line under the heading: the section also covers `0.7.0`,
which shipped without one. No later release needs the line: since AI-3557, `# Unreleased`
holds only breaking-change lines between releases. For the first release after `0.7.0`, run the
listing above from `v0.6.9` (the release before `0.7.0`) instead of `0.7.0`, so 0.7.0's PRs are
listed too.
- Keep three sections, in this order: `## Breaking Changes`, `## New Features`, `## Bug Fixes`.
Merge sections that appear twice or under another name (`## Features`). The `# Unreleased`
written before AI-3557 has both problems.
- Add an entry for each user-facing PR that has none: a `###` title and one or two sentences,
ending with the PR number, e.g. `(#2207)`. Since AI-3557, PRs add only breaking-change lines,
so most of the entries are written here. Skip docs-only, CI-only, test-only and skill-only PRs.

Open the PR with the title `Release vX.Y.Z: CHANGELOG`. It needs one approving review. Merge it
before you tag.

## 3. Tag the merge commit

```bash
set -euo pipefail
git fetch origin --tags
SHA=<merge commit of the CHANGELOG PR>
git merge-base --is-ancestor "$SHA" origin/main
test -z "$(git tag --points-at "$SHA")"
git tag vX.Y.Z "$SHA"
```

Do not push the tag yet: step 4 checks it first.

The tag must start with `v`: `release.yml` runs its jobs only when the tag starts with `v`.
`0.7.0` had no `v`, so nothing ran (AI-3561). The commit must carry no other tag. The Python
version is taken from the nearest tag of any kind, and on `main` that is usually a router deploy
tag: between releases, `hatch version` prints a version like `0.6.372.dev14`, from
`accelerate-v0.6.371`.

## 4. Check the version the packages will get

```bash
git worktree add --detach <scratch dir> vX.Y.Z
(cd <scratch dir>/sdks/python && uvx -q --from 'hatch==1.18.2' hatch version)
git worktree remove <scratch dir>
```

It must print `X.Y.Z` exactly. If it does not, stop: delete the local tag (`git tag -d vX.Y.Z`)
and do not publish. If it does, push the tag: `git push origin vX.Y.Z`.

## 5. Publish the GitHub release (ask first)

```bash
gh release create vX.Y.Z -R GetStream/Agents --verify-tag --title vX.Y.Z \
--generate-notes --notes-start-tag <previous tag> \
--notes "Changelog: https://github.com/GetStream/Agents/blob/vX.Y.Z/CHANGELOG.md (section \`# vX.Y.Z\`)"
```

The body is GitHub's generated list of merged PRs, with the `--notes` line before it
(`gh release create --help`: "Additional release notes can be prepended to automatically
generated notes by using the `--notes` flag"). The CHANGELOG section is not copied into the body.

## 6. Check what was published

- `gh run list -R GetStream/Agents --workflow release.yml --limit 1` must show the new tag with
`success`.
- `curl -s https://pypi.org/pypi/vision-agents/json | jq -r .info.version` must print `X.Y.Z`.

`release.yml` has never succeeded: of its 41 runs, 34 ended `failure`, 3 `startup_failure`, 3
`cancelled` and 1 `skipped`. The packages of 0.6.5 to 0.6.9 reached PyPI outside it, and 0.6.9
has no Trusted Publishing provenance (AI-3561). Until AI-3561 is fixed, step 6 is unverified. If the run does not succeed, the packages are not on PyPI. Report it
on AI-3561, and do not upload by hand.
4 changes: 2 additions & 2 deletions .github/workflows/publish-sdk-kotlin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ name: Publish Kotlin SDK
# If the run of a release merge says nothing is published, re-run all its jobs: the lookup of
# its pull request can lag right after the merge.
#
# There is no GitHub release: publishing one starts the Python release (release.yml), and the
# repository's releases are the Python packages'.
# There is no GitHub release: publishing one starts release.yml, and the repository's releases
# (vX.Y.Z) are of the whole repo, not of this SDK.
on:
push:
branches: [ "main", "release-kotlin-*-SNAPSHOT" ]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-sdk-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Release Go SDK (verify)
# A Go module is released by its tag: pushing sdks/go/vX.Y.Z is the release, and the Go module
# proxy fetches it the first time anybody asks for it. This checks the tagged copy, then asks
# for it from an empty module outside this repository, as a consumer would. It publishes
# nothing and creates no GitHub Release: release.yml publishes the Python packages on any
# published release.
# nothing and creates no GitHub Release: release.yml publishes the Python packages when a
# release is published for a tag that starts with `v`.
on:
push:
tags: [ 'sdks/go/v*' ]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-sdk-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
semantic-release $([ "$DRY_RUN" = "true" ] && echo --dry-run)

# The release is created as a draft so that publishing it can leave the repository's
# latest release where it is: the Python packages' `v*`.
# latest release where it is: the repo's `vX.Y.Z` release.
- name: Publish the GitHub release
if: ${{ !inputs.dry_run }}
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
permissions:
contents: read

# Only a release of the Python packages, tagged vX.Y.Z, publishes them. A release made for
# another tag, such as the Go SDK's sdks/go/vX.Y.Z, sdk-js-vX.Y.Z, accelerate-vX.Y.Z or
# sdk-dotnet-vX.Y.Z, runs nothing here.
# Only a release of the whole repo, tagged vX.Y.Z, publishes the Python packages. A release
# made for another tag, such as the Go SDK's sdks/go/vX.Y.Z, sdk-js-vX.Y.Z, accelerate-vX.Y.Z
# or sdk-dotnet-vX.Y.Z, runs nothing here.
jobs:
integration:
if: startsWith(github.event.release.tag_name, 'v')
Expand Down
18 changes: 9 additions & 9 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ module-level `logger = logging.getLogger(__name__)`. Use `debug` for lifecycle,
lines at the same place, any two open PRs conflicted there. One exception: a PR that breaks a
published SDK's API (Go: a renamed or removed field or signature) adds one line under
`# Unreleased` → **Breaking Changes**.
- It is written once per release, in the PR that prepares a Python packages release
(`.github/workflows/release.yml`). Router deploy tags (`accelerate-v*`) and SDK tags
get no section.
- That PR turns `# Unreleased` and the PRs merged since the previous Python release into one version
heading (`# v0.4.0`), with sections **Breaking Changes**, **New Features**, **Bug Fixes**.
The previous release is the newest Python one in `gh release list -R GetStream/Agents`. A Python
release's tag is the bare version (`vX.Y.Z` or `X.Y.Z`), with no `sdk-`, `sdks/go/` or
`accelerate-` prefix; `v0.6.9` and `0.7.0` both exist.
- It is written once per release, with the `release` skill (`.claude/skills/release/SKILL.md`).
A release is one version of the whole repo (router, SDKs, Python packages, apps): a `vX.Y.Z`
tag on `main`, whose GitHub release also publishes the Python packages. Router deploy tags
(`accelerate-v*`) and SDK tags get no section.
- The release PR turns `# Unreleased` and every user-facing PR merged since the previous release
into one version heading (`# v0.4.0`), with sections **Breaking Changes**, **New Features**,
**Bug Fixes**.
- Only include user-facing changes (public API breaks, features, fixes). Skip docs-only and CI-only commits.
- Reference PR numbers inline, e.g. `(#374)`.
- To generate: `git log <previous release tag>..HEAD --oneline --no-merges`, then classify each commit.
- To generate: follow step 2 of the `release` skill, which lists the PRs merged since the previous
release tag; then classify each one.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PackageDescription

// The Swift SDK, whose sources are in sdks/swift/core. The manifest is at the root of the
// repository because that is the only place SwiftPM looks for it: an app adds this
// repository's URL, and each `v` tag, the Python packages' too, is a release of it.
// repository's URL, and each `vX.Y.Z` tag of the repo is a release of it.
let package = Package(
name: "stream-agents",
// iOS 15 is the floor. The session state is an ObservableObject rather than @Observable,
Expand Down
2 changes: 1 addition & 1 deletion sdks/js/release.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default {
"@semantic-release/github",
{
// A draft, published by the workflow with `--latest=false`, so the repository's
// latest release stays the Python one.
// latest release stays the repository's vX.Y.Z release.
draftRelease: true,
releaseNameTemplate: "@stream-io/stream-agents v<%= nextRelease.version %>",
// Every commit since the last tag is in context, router ones included, so a comment
Expand Down
3 changes: 2 additions & 1 deletion sdks/kotlin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,4 +446,5 @@ Other merges into `main` publish nothing, even one that sets a new `version`: on
pull request from a `release-kotlin-X.Y.Z` branch publishes. If a release merge's run says nothing
is published, re-run all its jobs: the lookup of its pull request can lag right after the merge.

There is no GitHub release: publishing one starts the Python release, `release.yml`.
There is no GitHub release: publishing one starts `release.yml`, and a release is of the whole
repository, not of this SDK.
Loading