Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
feat(release): publish switch-core release candidates without moving latest (#601)
Louis Amaudruza8f9b3f50655
diff --git a/.github/workflows/switch-release.yml b/.github/workflows/switch-release.ymlindex 43a56ef4c..d4be7f7b0 100644--- a/.github/workflows/switch-release.yml+++ b/.github/workflows/switch-release.yml@@ -9,6 +9,14 @@ name: switch release# MUST match pyproject.toml `[project].version`; the prep job verifies this).# `workflow_dispatch` builds everything WITHOUT pushing, for verification.#+# Release candidates: push `switch-v0.30.0-rc.1` on a commit that is on `main` or+# a `release/*` branch. The base version must be at or above pyproject's and not+# already released. An RC publishes the images, chart and compose under its own+# version only — never `latest` — so nothing that follows `latest` picks up an+# untested build, and Helm skips it unless asked for with `--devel` or an exact+# `--version`. pyproject's version is stamped on the runner (PEP 440 form,+# `0.30.0rc1`) so the running server reports the RC it is; nothing is committed.+## Artifacts go to GHCR by default, and the packages are public alongside the# repo. REGISTRY / IMAGE_NAMESPACE are the only things to change to retarget# another registry (e.g. ECR) — a config flip, not a rewrite.@@ -33,32 +41,68 @@ jobs:contents: readoutputs:version: ${{ steps.version.outputs.version }}+ python_version: ${{ steps.version.outputs.python_version }}push: ${{ steps.version.outputs.push }}+ latest: ${{ steps.version.outputs.latest }}compose_speaks: ${{ steps.contract.outputs.speaks }}compose_accepts: ${{ steps.contract.outputs.accepts }}steps:- name: Checkoutuses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0+ with:+ # Branch and tag history, to check which branches contain an RC tag.+ fetch-depth: 0- name: Resolve versionid: version- # On a tag: version is the tag minus `switch-v`, and we push. On a+ # On a release tag: version is the tag minus `switch-v`, and we push and+ # move `latest`. On an RC tag: push under the RC version only. On a# dispatch run: use pyproject's version and DON'T push (build-only).run: |pkg_version="$(python3 -c "import tomllib; print(tomllib.load(open('core/pyproject.toml','rb'))['project']['version'])")"if [[ "$GITHUB_REF" == refs/tags/* ]]; thentag_version="${GITHUB_REF_NAME#switch-v}"- if [ "$tag_version" != "$pkg_version" ]; then- echo "::error::Tag version ($tag_version) does not match core/pyproject.toml version ($pkg_version). Bump pyproject and re-tag."+ if [[ "$tag_version" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-rc\.([0-9]+)$ ]]; then+ base="${BASH_REMATCH[1]}"+ python_version="${base}rc${BASH_REMATCH[2]}"+ echo "rc base=$base pyproject=$pkg_version"+ if [ "$(printf '%s\n%s\n' "$pkg_version" "$base" | sort -V | head -n1)" != "$pkg_version" ]; then+ echo "::error::RC base version $base is below core/pyproject.toml $pkg_version."+ exit 1+ fi+ if git rev-parse -q --verify "refs/tags/switch-v$base" >/dev/null; then+ echo "::error::switch-v$base is already released; an RC must precede a later version."+ exit 1+ fi+ commit="$(git rev-parse "$GITHUB_REF^{commit}")"+ branches="$(git branch -r --contains "$commit" --format='%(refname:short)')"+ echo "branches containing $commit:"+ echo "$branches"+ if ! printf '%s\n' "$branches" | grep -Eq '^origin/(main|release/.+)$'; then+ echo "::error::RC tag $GITHUB_REF_NAME points at $commit, which is not on main or a release/* branch."+ exit 1+ fi+ latest=false+ elif [ "$tag_version" = "$pkg_version" ]; then+ python_version="$pkg_version"+ latest=true+ else+ echo "::error::Tag version ($tag_version) does not match core/pyproject.toml version ($pkg_version). Bump pyproject and re-tag, or tag a release candidate as switch-v<version>-rc.<n>."exit 1fi- echo "version=$tag_version" >> "$GITHUB_OUTPUT"- echo "push=true" >> "$GITHUB_OUTPUT"+ push=trueelse- echo "version=$pkg_version" >> "$GITHUB_OUTPUT"- echo "push=false" >> "$GITHUB_OUTPUT"+ tag_version="$pkg_version"+ python_version="$pkg_version"+ push=false+ latest=falsefi- echo "Resolved version=$pkg_version (push on tag only)"+ {+ echo "version=$tag_version"+ echo "python_version=$python_version"+ echo "push=$push"+ echo "latest=$latest"+ } | tee -a "$GITHUB_OUTPUT"# The published compose artifact declares its stack-compose range twice:# in the file (for whoever has already downloaded it) and as an OCI@@ -95,6 +139,24 @@ jobs:- name: Checkoutuses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0+ - name: Stamp the release candidate version+ # The server reports its version from the installed package metadata,+ # which comes from pyproject. Written here for an RC, never committed.+ if: ${{ needs.prep.outputs.python_version != needs.prep.outputs.version }}+ env:+ PYTHON_VERSION: ${{ needs.prep.outputs.python_version }}+ run: |+ python3 - <<'PY'+ import os, re+ path = "core/pyproject.toml"+ text = open(path).read()+ stamped, n = re.subn(r'(?m)^version = ".*"$', f'version = "{os.environ["PYTHON_VERSION"]}"', text, count=1)+ if n != 1:+ raise SystemExit(f"no [project] version line found in {path}")+ open(path, "w").write(stamped)+ PY+ grep -m1 '^version = ' core/pyproject.toml+- name: Set up QEMU# Enables arm64 emulation so buildx can produce a multi-arch manifest# from an amd64 runner.@@ -120,7 +182,7 @@ jobs:push: ${{ needs.prep.outputs.push == 'true' }}tags: |${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.image }}:${{ needs.prep.outputs.version }}- ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.image }}:latest+ ${{ needs.prep.outputs.latest == 'true' && format('{0}/{1}/{2}:latest', env.REGISTRY, env.IMAGE_NAMESPACE, matrix.image) || '' }}cache-from: type=gha,scope=${{ matrix.image }}cache-to: type=gha,scope=${{ matrix.image }},mode=max@@ -186,12 +248,12 @@ jobs:# Publishes deploy/local/standalone-docker-compose.yml to GHCR as an OCI# artifact, stamped with the same version as the images so a single tag# pins the whole standalone stack. Switch Console bundles this exact file at- # build time. `latest` moves with each release.+ # build time. `latest` moves with each release, never with an RC.if: ${{ needs.prep.outputs.push == 'true' }}working-directory: deploy/localrun: |oras push \- "$REGISTRY/$IMAGE_NAMESPACE/standalone-compose:${{ needs.prep.outputs.version }},latest" \+ "$REGISTRY/$IMAGE_NAMESPACE/standalone-compose:${{ needs.prep.outputs.version }}${{ needs.prep.outputs.latest == 'true' && ',latest' || '' }}" \--artifact-type application/vnd.switch.compose.v1+yaml \--annotation "org.opencontainers.image.version=${{ needs.prep.outputs.version }}" \--annotation "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \diff --git a/RELEASING.md b/RELEASING.mdindex 5893cf5d9..834d70b2b 100644--- a/RELEASING.md+++ b/RELEASING.md@@ -83,6 +83,26 @@ peer still on it, and it can never be raised past what is running in the field.You can also trigger `workflow_dispatch` manually from the Actions tab to test abuild without creating a release.+### Release candidates++To publish a pre-release of the stack for staging, pilot or a canary Console,+tag a release candidate. Don't bump `core/pyproject.toml` first:++```bash+git tag switch-v0.30.0-rc.1 <commit on main> # or on release/0.30+git push origin switch-v0.30.0-rc.1+```++- **Only from `main` or `release/*`.** The workflow refuses a tag whose commit is on+ neither.+- **The version previews the next release.** The base (`0.30.0`) must be at or above+ `core/pyproject.toml` and not already released as `switch-v0.30.0`.+- **Never `latest`.** Images, chart and compose are pushed under `0.30.0-rc.1` only.+ `helm install` skips the chart unless given `--devel` or that exact `--version`.+- **The server reports the RC.** The workflow stamps `0.30.0rc1` (the PEP 440 form)+ into `core/pyproject.toml` on the runner, so the running server's version says+ which candidate it is. Nothing is committed.+## Switch Console desktop app release (separate)The desktop app (`console/`) releases on its own tag, `switch-console-v<version>`, via