Skip to content

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

fix(release): use Changesets v3 action protocol

jkomyno3e8ce1eae27f
diff --git a/.github/workflows/ts.release.yml b/.github/workflows/ts.release.yml
index 16ff51e29..097fd0fc4 100644
--- a/.github/workflows/ts.release.yml
+++ b/.github/workflows/ts.release.yml
@@ -60,20 +60,18 @@ jobs:
- name: Create Release Pull Request & Publish packages
id: changesets
- uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0
+ uses: changesets/action@8488615a623b1b9c987934bb89eae8af6a946ac1 # v2.1.1
if: github.event_name != 'workflow_dispatch' # only run on master merges
- env:
- GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- GITHUB_ACCESS_TOKEN: ${{ steps.app-token.outputs.token }}
with:
- publish: pnpm changeset:release
- commit: 'Release: update version'
- title: 'Release: update version'
+ github-token: ${{ steps.app-token.outputs.token }}
+ publish-script: pnpm changeset:release
+ commit-message: 'Release: update version'
+ pr-title: 'Release: update version'
- name: Set Version Info
if: steps.changesets.outputs.published == 'true'
env:
- PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
+ PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.published-packages }}
run: |
SLACK_VERSIONS=""
while read -r pkg; do
diff --git a/test/release-workflow.test.ts b/test/release-workflow.test.ts
index fb0ef828c..69aeb0caf 100644
--- a/test/release-workflow.test.ts
+++ b/test/release-workflow.test.ts
@@ -258,7 +258,7 @@ touch "$target/dist/provider.whl"
}
}
-if (!tsReleaseWorkflow.includes('publish: pnpm changeset:release')) {
+if (!tsReleaseWorkflow.includes('publish-script: pnpm changeset:release')) {
throw new Error('ts.release.yml must use the repository-controlled changeset:release script');
}
@@ -336,6 +336,25 @@ if (
throw new Error('ts.release.yml must validate pending changesets before changesets/action');
}
+if (!tsReleaseWorkflow.includes('changesets/action@8488615a623b1b9c987934bb89eae8af6a946ac1 # v2.1.1')) {
+ throw new Error('ts.release.yml must use changesets/action v2 with Changesets v3');
+}
+
+for (const input of [
+ 'github-token: ${{ steps.app-token.outputs.token }}',
+ 'publish-script: pnpm changeset:release',
+ "commit-message: 'Release: update version'",
+ "pr-title: 'Release: update version'",
+]) {
+ if (!tsReleaseWorkflow.includes(input)) {
+ throw new Error(`ts.release.yml must use the changesets/action v2 ${input} input`);
+ }
+}
+
+if (!tsReleaseWorkflow.includes('steps.changesets.outputs.published-packages')) {
+ throw new Error('ts.release.yml must read the changesets/action v2 published-packages output');
+}
+
if (changesetConfig.baseBranch !== 'next') {
throw new Error('changesets must compare against next, the active release branch');
}
@@ -425,9 +444,9 @@ if (!releaseScript.includes('pnpm changeset publish')) {
throw new Error('release script must still publish non-CLI changeset packages');
}
-if (!releaseScript.includes('New tag:[[:space:]]*@composio\\/cli@')) {
+if (!releaseScript.includes('CHANGESETS_OUTPUT')) {
throw new Error(
- 'release script must filter @composio/cli tag output before changesets/action creates GitHub releases'
+ 'release script must filter @composio/cli Changesets v3 output before changesets/action creates GitHub releases'
);
}
@@ -781,6 +800,7 @@ for (const guide of mirroredUninstallGuides) {
const fakeBin = mkdtempSync(join(tmpdir(), 'composio-release-test-'));
try {
const fakePnpmPath = join(fakeBin, 'pnpm');
+ const changesetsOutputPath = join(fakeBin, 'changesets-output.ndjson');
writeFileSync(
fakePnpmPath,
`#!/usr/bin/env bash
@@ -790,8 +810,8 @@ case "$*" in
exit 0
;;
"changeset publish")
- echo 'New tag: @composio/[email protected]'
- echo 'New tag: @composio/[email protected]'
+ printf '%s\\n' '{"type":"git-tag","tag":"@composio/[email protected]","packageName":"@composio/core"}' > "$CHANGESETS_OUTPUT"
+ printf '%s\\n' '{"type":"git-tag","tag":"@composio/[email protected]","packageName":"@composio/cli"}' >> "$CHANGESETS_OUTPUT"
echo 'release warning preserved' >&2
exit 0
;;
@@ -806,7 +826,11 @@ esac
const result = spawnSync('bash', [releaseScriptPath], {
encoding: 'utf8',
- env: { ...process.env, PATH: `${fakeBin}:${process.env.PATH}` },
+ env: {
+ ...process.env,
+ CHANGESETS_OUTPUT: changesetsOutputPath,
+ PATH: `${fakeBin}:${process.env.PATH}`,
+ },
});
if (result.status !== 0) {
@@ -815,12 +839,16 @@ esac
);
}
- if (!result.stdout.includes('New tag: @composio/[email protected]')) {
- throw new Error('release script must preserve non-CLI changeset tags');
- }
-
- if (result.stdout.includes('@composio/[email protected]')) {
- throw new Error('release script must hide @composio/cli tags from changesets/action');
+ const outputEvents = readFileSync(changesetsOutputPath, 'utf8')
+ .trim()
+ .split('\n')
+ .map(line => JSON.parse(line));
+ if (
+ outputEvents.length !== 1 ||
+ outputEvents[0].packageName !== '@composio/core' ||
+ outputEvents[0].tag !== '@composio/[email protected]'
+ ) {
+ throw new Error('release script must retain only non-CLI Changesets v3 git-tag events');
}
if (!result.stderr.includes('release warning preserved')) {
diff --git a/ts/scripts/changeset-release.sh b/ts/scripts/changeset-release.sh
index 2e164f66c..d9215f547 100755
--- a/ts/scripts/changeset-release.sh
+++ b/ts/scripts/changeset-release.sh
@@ -1,25 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail
-# changesets/action infers which GitHub tags/releases to push from `New tag:`
-# lines printed by `changeset publish`. The CLI binary workflow owns
-# @composio/cli GitHub Releases because those releases must include platform
-# binary assets. Let changesets publish/tag every other package, but hide the
-# private CLI tag from changesets/action so ts.release.yml cannot create an
-# empty @composio/cli GitHub Release.
+# changesets/action v2 reads Changesets v3's NDJSON events from
+# CHANGESETS_OUTPUT. The CLI binary workflow owns @composio/cli GitHub Releases
+# because those releases must include platform binary assets. Remove only that
+# package's git-tag event so changesets/action publishes and releases every
+# other package without creating an empty @composio/cli GitHub Release.
-stdout_file=$(mktemp)
-stderr_file=$(mktemp)
-trap 'rm -f "$stdout_file" "$stderr_file"' EXIT
+filtered_output_file=$(mktemp)
+trap 'rm -f "$filtered_output_file"' EXIT
pnpm run build:packages
set +e
-pnpm changeset publish >"$stdout_file" 2>"$stderr_file"
+pnpm changeset publish
status=$?
set -e
-sed '/New tag:[[:space:]]*@composio\/cli@/d' "$stdout_file"
-cat "$stderr_file" >&2
+if [ -n "${CHANGESETS_OUTPUT:-}" ] && [ -f "$CHANGESETS_OUTPUT" ]; then
+ jq -c 'select(.packageName != "@composio/cli")' "$CHANGESETS_OUTPUT" >"$filtered_output_file"
+ mv "$filtered_output_file" "$CHANGESETS_OUTPUT"
+fi
exit "$status"