diff --git a/.github/workflows/publish_npm_agentkit_langchain.yml b/.github/workflows/publish_npm_agentkit_langchain.yml deleted file mode 100644 index 5a7b32e01..000000000 --- a/.github/workflows/publish_npm_agentkit_langchain.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Publish AgentKit LangChain to NPM - -on: - workflow_dispatch: - -jobs: - deploy-npm-agentkit-langchain: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "18" - registry-url: "https://registry.npmjs.org" - cache: "npm" - cache-dependency-path: ./typescript - - name: Install and build - working-directory: ./typescript - run: | - npm ci - npm run build - - name: Publish @coinbase/agentkit-langchain - working-directory: ./typescript/framework-extensions/langchain - run: | - npm publish --ignore-scripts --provenance --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish_npm_agentkit_model_context_protocol.yml b/.github/workflows/publish_npm_agentkit_model_context_protocol.yml deleted file mode 100644 index 339404fce..000000000 --- a/.github/workflows/publish_npm_agentkit_model_context_protocol.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Publish AgentKit Model Context Protocol to NPM - -on: - workflow_dispatch: - -jobs: - deploy-npm-agentkit-model-context-protocol: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "18" - registry-url: "https://registry.npmjs.org" - cache: "npm" - cache-dependency-path: ./typescript - - name: Install and build - working-directory: ./typescript - run: | - npm ci - npm run build - - name: Publish @coinbase/agentkit-model-context-protocol - working-directory: ./typescript/framework-extensions/model-context-protocol - run: | - npm publish --ignore-scripts --provenance --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish_npm_agentkit_vercel_ai_sdk.yml b/.github/workflows/publish_npm_agentkit_vercel_ai_sdk.yml deleted file mode 100644 index 335c81980..000000000 --- a/.github/workflows/publish_npm_agentkit_vercel_ai_sdk.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Publish AgentKit Vercel AI SDK to NPM - -on: - workflow_dispatch: - -jobs: - deploy-npm-agentkit-vercel-ai-sdk: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "18" - registry-url: "https://registry.npmjs.org" - cache: "npm" - cache-dependency-path: ./typescript - - name: Install and build - working-directory: ./typescript - run: | - npm ci - npm run build - - name: Publish @coinbase/agentkit-vercel-ai-sdk - working-directory: ./typescript/framework-extensions/vercel-ai-sdk - run: | - npm publish --ignore-scripts --provenance --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish_npm_create_onchain_agent.yml b/.github/workflows/publish_npm_create_onchain_agent.yml deleted file mode 100644 index 0d783b972..000000000 --- a/.github/workflows/publish_npm_create_onchain_agent.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Publish Create Onchain Agent to NPM - -on: - workflow_dispatch: - -jobs: - deploy-npm-create-onchain-agent: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "18" - registry-url: "https://registry.npmjs.org" - cache: "npm" - cache-dependency-path: ./typescript - - name: Install, build and publish create-onchain-agent - working-directory: ./typescript/create-onchain-agent - run: | - npm ci - npm run build - npm publish --provenance --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish_npm_agentkit.yml b/.github/workflows/publish_npm_manual.yml similarity index 58% rename from .github/workflows/publish_npm_agentkit.yml rename to .github/workflows/publish_npm_manual.yml index 02324070b..97e879c14 100644 --- a/.github/workflows/publish_npm_agentkit.yml +++ b/.github/workflows/publish_npm_manual.yml @@ -1,10 +1,16 @@ -name: Publish AgentKit to NPM +name: Publish Package to NPM on: workflow_dispatch: + inputs: + directory: + description: "Directory within the 'typescript' folder containing the package to publish (e.g., agentkit)" + required: true + type: string + default: "agentkit" jobs: - deploy-npm-agentkit: + deploy-npm-package: runs-on: ubuntu-latest permissions: contents: read @@ -17,8 +23,8 @@ jobs: registry-url: "https://registry.npmjs.org" cache: "npm" cache-dependency-path: ./typescript - - name: Install, build and publish @coinbase/agentkit - working-directory: ./typescript/agentkit + - name: Install, build and publish package + working-directory: ./typescript/${{ inputs.directory }} run: | npm ci npm run build diff --git a/.github/workflows/version_publish_npm.yml b/.github/workflows/version_publish_npm.yml new file mode 100644 index 000000000..00a4d5787 --- /dev/null +++ b/.github/workflows/version_publish_npm.yml @@ -0,0 +1,41 @@ +name: Version and Publish NPM + +on: + push: + branches: + - main + workflow_dispatch: + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + version-and-publish: + name: Version and Publish + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "18" + registry-url: "https://registry.npmjs.org" + cache: "npm" + cache-dependency-path: ./typescript + + - name: Install dependencies + run: npm ci + working-directory: ./typescript + + - name: Version and/or Publish to NPM + uses: changesets/action@06245a4e0a36c064a573d4150030f5ec548e4fcc + with: + commit: "chore: version packages" + title: "chore: version packages" + version: npm run changeset:version + publish: npm run publish + cwd: ./typescript + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/CONTRIBUTING-TYPESCRIPT.md b/CONTRIBUTING-TYPESCRIPT.md index 07c50af17..af3d12490 100644 --- a/CONTRIBUTING-TYPESCRIPT.md +++ b/CONTRIBUTING-TYPESCRIPT.md @@ -276,7 +276,7 @@ Changesets are stored in the `.changeset` directory. Each changeset is stored as To add a changeset, use `changesets` to create it for you: ```bash -npx @changesets/cli +npm run changeset ``` This will kick off an interactive prompt to help you create the changeset. Use the arrow keys to navigate the different options, and press the `Space` key to select an option. You should select the package(s) you are making a change to – most of the time this will be `@coinbase/agentkit`. Once selected, hit `Enter`. You'll then be prompted to specify the type of change you are making (major, minor or patch), starting with major. Most of the time you will not be making a major change, so hitting `Enter` will progress to the next step. If you're adding a new feature, you should select `minor`. If you're fixing a bug, you should select `patch`. Once selected, you will be prompted to provide a summary of your changes. This should be a short, specific description in the past tense (see above for examples). diff --git a/typescript/package.json b/typescript/package.json index 4b192e02f..49b4647c7 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -21,6 +21,9 @@ "packageManager": "npm@8.9.0", "scripts": { "build": "turbo run build", + "changeset": "changeset", + "changeset:publish": "npm ci && npm run build && changeset publish", + "changeset:version": "changeset version", "test": "turbo run test", "lint": "turbo run lint", "clean": "turbo run clean", @@ -34,6 +37,9 @@ "author": "Coinbase Inc.", "license": "Apache-2.0", "repository": "https://github.com/coinbase/agentkit", + "publishConfig": { + "provenance": true + }, "keywords": [ "coinbase", "sdk",