Skip to content
Draft
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
44 changes: 38 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name: Publish

# Publishing uses npm trusted publishing (OIDC): npm exchanges the job's GitHub
# OIDC token for a short-lived, package-scoped publish token. No npm token is stored.
# Each package on npmjs.com trusts this repo, this workflow file and the `release`
# environment, which is restricted to the main branch.

on:
push:
branches: [main]

jobs:
publish-sdk:
runs-on: ubuntu-latest
environment: release

permissions:
contents: read
Expand All @@ -25,19 +31,32 @@ jobs:
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

# Trusted publishing requires npm >= 11.5.1; Node 20 ships npm 10.
- name: Upgrade npm
run: npm install -g npm@^11.5.1

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm run build

- name: Publish SDK to npm
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
name=$(node -p "require('./package.json').name")
version=$(node -p "require('./package.json').version")
# npm publish fails on an existing version, unlike pnpm's filtered publish, which skipped it.
if [ -n "$(npm view "$name@$version" version 2>/dev/null)" ]; then
echo "$name@$version is already published, skipping."
exit 0
fi
# pnpm pack resolves workspace: protocol dependencies; npm publish uses OIDC and adds provenance.
pnpm pack --pack-destination "$RUNNER_TEMP/pack"
npm publish "$RUNNER_TEMP"/pack/*.tgz --access public

publish-mcp:
runs-on: ubuntu-latest
environment: release

permissions:
contents: read
Expand All @@ -56,6 +75,10 @@ jobs:
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

# Trusted publishing requires npm >= 11.5.1; Node 20 ships npm 10.
- name: Upgrade npm
run: npm install -g npm@^11.5.1

- name: Install dependencies
run: pnpm install --frozen-lockfile

Expand All @@ -66,6 +89,15 @@ jobs:
run: pnpm --filter @tinybirdco/devtools-mcp build

- name: Publish MCP to npm
run: pnpm --filter @tinybirdco/devtools-mcp publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: mcp
run: |
name=$(node -p "require('./package.json').name")
version=$(node -p "require('./package.json').version")
# npm publish fails on an existing version, unlike pnpm's filtered publish, which skipped it.
if [ -n "$(npm view "$name@$version" version 2>/dev/null)" ]; then
echo "$name@$version is already published, skipping."
exit 0
fi
# pnpm pack rewrites "@tinybirdco/sdk": "workspace:*" to the real version.
pnpm pack --pack-destination "$RUNNER_TEMP/pack"
npm publish "$RUNNER_TEMP"/pack/*.tgz --access public
5 changes: 5 additions & 0 deletions mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"name": "@tinybirdco/devtools-mcp",
"version": "0.0.3",
"description": "Tinybird DevTools MCP Server",
"repository": {
"type": "git",
"url": "git+https://github.com/tinybirdco/tinybird-sdk-typescript.git",
"directory": "mcp"
},
"type": "module",
"main": "./dist/index.js",
"bin": {
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"name": "@tinybirdco/sdk",
"version": "0.0.84",
"description": "TypeScript SDK for Tinybird Forward - define datasources and pipes as TypeScript",
"repository": {
"type": "git",
"url": "git+https://github.com/tinybirdco/tinybird-sdk-typescript.git"
},
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down
Loading