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

next
yml 120 lines 4.91 KB
Raw
1 name: TS SDK beta release
2
3 on:
4 workflow_dispatch:
5 push:
6 # Stable releases use sdk.release.yml; this keeps the main beta lane.
7 branches: [main]
8
9 permissions:
10 contents: read
11
12 # Print Turborepo telemetry events to the logs instead of sending them.
13 env:
14 TURBO_TELEMETRY_DEBUG: 1
15
16 jobs:
17 release:
18 name: Release Typescript SDK
19 runs-on: ubuntu-latest
20 permissions:
21 contents: read
22 id-token: write
23 steps:
24 # Mint a short-lived GitHub App installation token instead of a long-lived
25 # PAT. App tokens don't expire out from under us (the old CI_BOT_TOKEN PAT
26 # did), and — unlike the default GITHUB_TOKEN — events they create (the
27 # "Release: update version" PR and its eventual merge) still trigger
28 # downstream workflows like build-cli-binaries.yml, so publishing fires.
29 - name: Generate GitHub App token
30 id: app-token
31 uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
32 with:
33 client-id: ${{ vars.RELEASE_BOT_CLIENT_ID }}
34 private-key: ${{ secrets.RELEASE_BOT_APP_PRIVATE_KEY }}
35
36 - name: Checkout Code
37 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
38 with:
39 fetch-depth: 0 # Required for git show HEAD^ when comparing published package versions
40 token: ${{ steps.app-token.outputs.token }}
41
42 - name: Setup Node.js, pnpm, Bun
43 uses: ./.github/actions/setup-node-pnpm-bun
44 with:
45 # Keep the release runtime explicitly pinned because trusted publishing
46 # depends on the npm bundled with this Node.js release, even though the
47 # pin currently matches the repository toolchain.
48 node-version: '24.22.3'
49
50 - name: Install Dependencies
51 run: pnpm install --frozen-lockfile
52
53 - name: Validate Changesets
54 run: pnpm validate:changesets
55
56 - name: Run Linting
57 run: pnpm lint
58
59 - name: Run Build
60 run: pnpm run build:packages
61
62 - name: Create Release Pull Request & Publish packages
63 id: changesets
64 uses: changesets/action@ae32849d5ba541f9ae29e40e22a623bc13562f51 # v2.1.2
65 if: github.event_name != 'workflow_dispatch' # only run on master merges
66 with:
67 github-token: ${{ steps.app-token.outputs.token }}
68 # SDKs publish to npm. The CLI binary workflow owns GitHub Releases.
69 create-github-releases: false
70 push-git-tags: true
71 publish-script: pnpm changeset:release
72 commit-message: 'Release: update version'
73 pr-title: 'Release: update version'
74
75 - name: Set Version Info
76 if: steps.changesets.outputs.published == 'true'
77 env:
78 PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.published-packages }}
79 run: |
80 SLACK_VERSIONS=""
81 while read -r pkg; do
82 NAME=$(jq -r '.name // empty' <<<"$pkg" 2>/dev/null || echo "")
83 NEW_VERSION=$(jq -r '.version // empty' <<<"$pkg" 2>/dev/null || echo "")
84 if [ -z "$NAME" ] || [ -z "$NEW_VERSION" ]; then
85 continue
86 fi
87
88 VERSION_LINE="⚡️ $NAME: \`$NEW_VERSION\`"
89 PKG_PATH=$(pnpm list --filter "$NAME" --json 2>/dev/null | jq -r '.[0].path // empty' 2>/dev/null || echo "")
90 if [ -n "$PKG_PATH" ]; then
91 REL_PKG_JSON_PATH="${PKG_PATH#$GITHUB_WORKSPACE/}/package.json"
92 OLD_VERSION=$(git show "HEAD^:$REL_PKG_JSON_PATH" 2>/dev/null | jq -r '.version // empty' 2>/dev/null || echo "")
93 if [ -n "$OLD_VERSION" ] && [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
94 VERSION_LINE="⚡️ $NAME: \`$OLD_VERSION\` -> \`$NEW_VERSION\`"
95 fi
96 fi
97 if [ -n "$SLACK_VERSIONS" ]; then
98 SLACK_VERSIONS="${SLACK_VERSIONS}"$'\n'"${VERSION_LINE}"
99 else
100 SLACK_VERSIONS="$VERSION_LINE"
101 fi
102 done < <(jq -c 'if type == "array" then .[] else empty end' <<<"$PUBLISHED_PACKAGES" 2>/dev/null || true)
103 if [ -z "$SLACK_VERSIONS" ]; then
104 SLACK_VERSIONS="No version info available"
105 fi
106 # Build a single-line JSON payload so multiline version info is safely escaped.
107 SLACK_PAYLOAD=$(jq -nc \
108 --arg repository "$GITHUB_REPOSITORY" \
109 --arg versions "$SLACK_VERSIONS" \
110 --arg sha "$GITHUB_SHA" \
111 '{text: "🚀 New SDK version published!\n*Repository:* \($repository)\n*Versions:*\n\($versions)\n*Commit:* \($sha)"}')
112 echo "SLACK_PAYLOAD=$SLACK_PAYLOAD" >> "$GITHUB_ENV"
113
114 - name: Send Slack Notification
115 if: steps.changesets.outputs.published == 'true'
116 uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
117 with:
118 webhook: ${{ secrets.SLACK_RELEASE_WEBHOOK_URL }}
119 webhook-type: incoming-webhook
120 payload: ${{ env.SLACK_PAYLOAD }}