Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

ci: add CD workflows for Node SDK packages with OIDC trusted publishing (#4670)

Saket Aryanb5345f849830
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
index 30d93e9a8..2da4e97e1 100644
--- a/.github/workflows/cd.yml
+++ b/.github/workflows/cd.yml
@@ -7,6 +7,7 @@ on:
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
+ if: startsWith(github.event.release.tag_name, 'v')
runs-on: ubuntu-latest
permissions:
id-token: write
diff --git a/.github/workflows/cli-node-cd.yml b/.github/workflows/cli-node-cd.yml
new file mode 100644
index 000000000..9190bf661
--- /dev/null
+++ b/.github/workflows/cli-node-cd.yml
@@ -0,0 +1,43 @@
+name: Publish @mem0/cli πŸ“¦ to npm
+
+on:
+ release:
+ types: [published]
+
+jobs:
+ build-n-publish:
+ name: Build and publish @mem0/cli πŸ“¦ to npm
+ if: startsWith(github.event.release.tag_name, 'cli-node-v')
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ defaults:
+ run:
+ working-directory: cli/node
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v4
+ with:
+ version: 10
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '22'
+ registry-url: 'https://registry.npmjs.org'
+ cache: 'pnpm'
+ cache-dependency-path: cli/node/pnpm-lock.yaml
+
+ - name: Upgrade npm for OIDC trusted publishing
+ run: npm install -g npm@latest
+
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+
+ - name: Build
+ run: pnpm run build
+
+ - name: Publish to npm
+ run: npm publish --provenance --access public
diff --git a/.github/workflows/ts-sdk-cd.yml b/.github/workflows/ts-sdk-cd.yml
new file mode 100644
index 000000000..74163a323
--- /dev/null
+++ b/.github/workflows/ts-sdk-cd.yml
@@ -0,0 +1,43 @@
+name: Publish mem0ai πŸ“¦ to npm
+
+on:
+ release:
+ types: [published]
+
+jobs:
+ build-n-publish:
+ name: Build and publish mem0ai πŸ“¦ to npm
+ if: startsWith(github.event.release.tag_name, 'ts-v')
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ defaults:
+ run:
+ working-directory: mem0-ts
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v4
+ with:
+ version: 10
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '22'
+ registry-url: 'https://registry.npmjs.org'
+ cache: 'pnpm'
+ cache-dependency-path: mem0-ts/pnpm-lock.yaml
+
+ - name: Upgrade npm for OIDC trusted publishing
+ run: npm install -g npm@latest
+
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+
+ - name: Build
+ run: pnpm run build
+
+ - name: Publish to npm
+ run: npm publish --provenance --access public
diff --git a/.github/workflows/vercel-ai-cd.yml b/.github/workflows/vercel-ai-cd.yml
new file mode 100644
index 000000000..6cc2a4995
--- /dev/null
+++ b/.github/workflows/vercel-ai-cd.yml
@@ -0,0 +1,43 @@
+name: Publish @mem0/vercel-ai-provider πŸ“¦ to npm
+
+on:
+ release:
+ types: [published]
+
+jobs:
+ build-n-publish:
+ name: Build and publish @mem0/vercel-ai-provider πŸ“¦ to npm
+ if: startsWith(github.event.release.tag_name, 'vercel-ai-v')
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ defaults:
+ run:
+ working-directory: vercel-ai-sdk
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v4
+ with:
+ version: 10
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '22'
+ registry-url: 'https://registry.npmjs.org'
+ cache: 'pnpm'
+ cache-dependency-path: vercel-ai-sdk/pnpm-lock.yaml
+
+ - name: Upgrade npm for OIDC trusted publishing
+ run: npm install -g npm@latest
+
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+
+ - name: Build
+ run: pnpm run build
+
+ - name: Publish to npm
+ run: npm publish --provenance --access public
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c27d3a023..7063614ae 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -61,3 +61,30 @@ make test # After activating a shell with hatch shell test_XX
Make sure that all tests pass across all supported Python versions before submitting a pull request.
We look forward to your pull requests and can't wait to see your contributions!
+
+### πŸš€ Releasing
+
+All packages are published automatically via GitHub Actions when a GitHub Release is created with the correct tag prefix.
+
+#### Tag Prefixes
+
+| Package | Registry | Tag Prefix | Example |
+|---------|----------|------------|---------|
+| `mem0ai` (Python SDK) | PyPI | `v*` | `v0.1.31` |
+| `mem0-cli` (Python CLI) | PyPI | `cli-v*` | `cli-v0.2.1` |
+| `mem0ai` (TypeScript SDK) | npm | `ts-v*` | `ts-v2.4.6` |
+| `@mem0/cli` (Node CLI) | npm | `cli-node-v*` | `cli-node-v0.1.2` |
+| `@mem0/vercel-ai-provider` | npm | `vercel-ai-v*` | `vercel-ai-v2.0.6` |
+
+#### How to Release
+
+1. Bump the version in `pyproject.toml` (Python) or `package.json` (Node)
+2. Create a [GitHub Release](https://github.com/mem0ai/mem0/releases/new) with the matching tag prefix
+3. The correct workflow will trigger automatically β€” verify in the [Actions tab](https://github.com/mem0ai/mem0/actions)
+
+#### Publishing Details
+
+- **PyPI packages** use OIDC trusted publishing via `pypa/gh-action-pypi-publish`
+- **npm packages** use OIDC trusted publishing via npm CLI (>= 11.5.1) β€” no tokens or secrets required
+- All workflows require `permissions: id-token: write` for OIDC authentication
+- First publish of a new npm package must be done manually; OIDC works for subsequent versions
diff --git a/cli/node/package.json b/cli/node/package.json
index a20c0dbc0..6ba818a71 100644
--- a/cli/node/package.json
+++ b/cli/node/package.json
@@ -1,6 +1,6 @@
{
"name": "@mem0/cli",
- "version": "0.1.1",
+ "version": "0.1.2",
"description": "The official CLI for mem0 β€” the memory layer for AI agents",
"type": "module",
"bin": {