diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..e42d666 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,63 @@ +name: Publish to npm + +on: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: npm-publish + cancel-in-progress: false + +jobs: + publish: + if: >- + github.repository == 'browserbase/sdk-functions-node' && + github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + environment: npm-publish + permissions: + contents: read + id-token: write + + steps: + - name: Checkout release commit + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "24.x" + registry-url: https://registry.npmjs.org + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.12.1 + + - name: Setup npm for trusted publishing + run: npm install --global npm@11 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Lint and typecheck + run: pnpm run lint + + - name: Run unit tests + run: pnpm run test + + - name: Build SDK + run: pnpm run build + + - name: Run integration tests + run: pnpm run test:integration + + - name: Inspect package contents + run: npm publish --dry-run + + - name: Publish to npm + run: npm publish --access public --tag latest diff --git a/package.json b/package.json index ff4c0de..0deeb45 100644 --- a/package.json +++ b/package.json @@ -67,5 +67,9 @@ "dotenv": "^17.2.3", "tsx": "^4.20.5", "zod": "^4.1.5" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/browserbase/sdk-functions-node.git" } }