mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-12 04:29:51 +08:00
The e2e job's first shard builds the MCP package, packs it, installs the tarball in an empty directory and runs packages/mcp-server/tests/e2e against the installed dist/index.js (MCP_SERVER_ENTRY), so a shell that builds but fails in the browser, or a tarball missing a runtime dependency, fails the PR. Its traces go with the Playwright report. The publish workflow also triggers on the web app code the shell is bundled from (components, contexts, hooks, lib, stores, globals.css) and the root lockfile.
93 lines
2.9 KiB
YAML
93 lines
2.9 KiB
YAML
name: Publish MCP Server
|
|
|
|
# Publishes @next-ai-drawio/mcp-server to npm via OIDC trusted publishing
|
|
# (no token, no OTP). Triggers when packages/mcp-server or the web app code
|
|
# bundled into the canvas shell (scripts/build-shell.mjs) changes on main;
|
|
# skips silently if the package.json version is already on npm — so a
|
|
# release is just "bump the version in a PR and merge".
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "packages/mcp-server/**"
|
|
# The canvas shell is bundled from these with the root's lockfile
|
|
- "components/**"
|
|
- "contexts/**"
|
|
- "hooks/**"
|
|
- "lib/**"
|
|
- "stores/**"
|
|
- "app/globals.css"
|
|
- "package-lock.json"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
id-token: write # OIDC token for npm trusted publishing
|
|
|
|
concurrency:
|
|
group: publish-mcp
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: packages/mcp-server
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
cache: "npm"
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
packages/mcp-server/package-lock.json
|
|
registry-url: "https://registry.npmjs.org"
|
|
|
|
# Trusted publishing requires npm >= 11.5.1
|
|
- name: Update npm
|
|
run: npm install -g npm@latest
|
|
|
|
- name: Check if version is already published
|
|
id: version
|
|
run: |
|
|
LOCAL=$(node -p "require('./package.json').version")
|
|
if npm view "@next-ai-drawio/mcp-server@${LOCAL}" version >/dev/null 2>&1; then
|
|
echo "Version ${LOCAL} already on npm - nothing to publish"
|
|
echo "publish=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "Version ${LOCAL} not on npm - publishing"
|
|
echo "publish=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
# The canvas shell (scripts/build-shell.mjs) is bundled from the web
|
|
# app's components with the root's esbuild, Tailwind and React
|
|
- name: Install repository dependencies
|
|
if: steps.version.outputs.publish == 'true'
|
|
working-directory: .
|
|
run: npm ci
|
|
|
|
- name: Install dependencies
|
|
if: steps.version.outputs.publish == 'true'
|
|
run: npm ci
|
|
|
|
- name: Test
|
|
if: steps.version.outputs.publish == 'true'
|
|
run: npm test
|
|
|
|
# The build downloads the pinned draw.war from GitHub releases
|
|
# (scripts/fetch-drawio.mjs) and bundles a trimmed draw.io into
|
|
# dist/drawio; check-package confirms it is in the tarball
|
|
- name: Build and check package contents
|
|
if: steps.version.outputs.publish == 'true'
|
|
run: npm run build && npm run check-package
|
|
|
|
- name: Publish to npm
|
|
if: steps.version.outputs.publish == 'true'
|
|
run: npm publish
|