fix(mcp): publish mongo shell dependency
This commit is contained in:
@@ -73,6 +73,7 @@ jobs:
|
||||
const writeJson = (path, data) => fs.writeFileSync(path, `${JSON.stringify(data, null, 2)}\n`);
|
||||
|
||||
for (const path of [
|
||||
"packages/mongo-shell/package.json",
|
||||
"packages/node-core/package.json",
|
||||
"packages/cli/package.json",
|
||||
"packages/mcp-server/package.json",
|
||||
@@ -110,7 +111,7 @@ jobs:
|
||||
- name: Commit package release version
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
git add packages/node-core/package.json packages/cli/package.json packages/mcp-server/package.json packages/mcp-server/server.json
|
||||
git add packages/mongo-shell/package.json packages/node-core/package.json packages/cli/package.json packages/mcp-server/package.json packages/mcp-server/server.json
|
||||
if git diff --cached --quiet; then
|
||||
echo "Package versions already committed for ${VERSION}."
|
||||
else
|
||||
@@ -143,10 +144,64 @@ jobs:
|
||||
git push origin "refs/tags/${TAG}:refs/tags/${TAG}"
|
||||
fi
|
||||
|
||||
publish-mongo-shell:
|
||||
name: Publish mongo-shell
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{ needs.prepare.outputs.tag }}
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 22.13.0
|
||||
registry-url: https://registry.npmjs.org
|
||||
cache: pnpm
|
||||
cache-dependency-path: pnpm-lock.yaml
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Publish Mongo shell parser
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
VERSION: ${{ needs.prepare.outputs.version }}
|
||||
run: |
|
||||
PACKAGE_PATH="packages/mongo-shell/package.json"
|
||||
set_package_version() {
|
||||
PACKAGE_PATH="${PACKAGE_PATH}" PACKAGE_VERSION="$1" node <<'NODE'
|
||||
const fs = require("fs");
|
||||
const path = process.env.PACKAGE_PATH;
|
||||
const pkg = JSON.parse(fs.readFileSync(path, "utf8"));
|
||||
pkg.version = process.env.PACKAGE_VERSION;
|
||||
fs.writeFileSync(path, `${JSON.stringify(pkg, null, 2)}\n`);
|
||||
NODE
|
||||
}
|
||||
|
||||
# node-core@0.4.31 already references ^0.1.0, so bootstrap that version once to repair existing installs.
|
||||
if ! npm view "@dbx-app/mongo-shell@0.1.0" version >/dev/null 2>&1; then
|
||||
set_package_version "0.1.0"
|
||||
pnpm --filter @dbx-app/mongo-shell publish --access public --provenance --no-git-checks
|
||||
fi
|
||||
|
||||
set_package_version "${VERSION}"
|
||||
if npm view "@dbx-app/mongo-shell@${VERSION}" version >/dev/null 2>&1; then
|
||||
echo "@dbx-app/mongo-shell@${VERSION} already exists on npm; skipping."
|
||||
exit 0
|
||||
fi
|
||||
pnpm --filter @dbx-app/mongo-shell publish --access public --provenance --no-git-checks
|
||||
|
||||
publish-node-core:
|
||||
name: Publish node-core
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare
|
||||
# node-core keeps mongo-shell as a runtime dependency, so npm must receive it first.
|
||||
needs: [prepare, publish-mongo-shell]
|
||||
outputs:
|
||||
published-or-existing: ${{ steps.publish.outputs.published_or_existing }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user