Move database work off the main thread on Node.js 24 and improve message handling and runtime diagnostics. Preserve migration, restart, and concurrency coverage with the async SQLite driver.
110 lines
3.5 KiB
YAML
110 lines
3.5 KiB
YAML
name: Publish MCP to npm
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'packages/mcp/**'
|
|
# The action catalog is generated from @snowluma/onebot's specs, so an
|
|
# action change must republish the MCP snapshot.
|
|
- 'packages/onebot/**'
|
|
- 'package.json'
|
|
- 'pnpm-lock.yaml'
|
|
- 'pnpm-workspace.yaml'
|
|
- 'tsconfig.base.json'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: mcp-npm-publish-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
publish:
|
|
name: Build, test, and publish MCP
|
|
runs-on: ubuntu-latest
|
|
environment: SnowLuma
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
with:
|
|
version: 11.25.0
|
|
run_install: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
# Trusted Publishing requires Node >=22.14 and npm >=11.5.1.
|
|
# Node 24 ships a supported npm CLI; the application runtime stays
|
|
# pinned separately by .node-version.
|
|
node-version: '24'
|
|
cache: 'pnpm'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Type check MCP
|
|
run: pnpm --filter @snowluma/mcp typecheck
|
|
|
|
- name: Test MCP (regenerates + validates the action catalog)
|
|
run: pnpm --filter @snowluma/mcp test
|
|
|
|
- name: Build MCP
|
|
run: pnpm --filter @snowluma/mcp build
|
|
|
|
- name: Check npm package version
|
|
id: npm
|
|
working-directory: packages/mcp
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
package_name="$(node -e "const fs = require('node:fs'); console.log(JSON.parse(fs.readFileSync('package.json', 'utf8')).name)")"
|
|
package_version="$(node -e "const fs = require('node:fs'); console.log(JSON.parse(fs.readFileSync('package.json', 'utf8')).version)")"
|
|
|
|
{
|
|
echo "package_name=${package_name}"
|
|
echo "package_version=${package_version}"
|
|
} >> "${GITHUB_OUTPUT}"
|
|
|
|
if npm view "${package_name}@${package_version}" version >/dev/null 2>&1; then
|
|
echo "already_published=true" >> "${GITHUB_OUTPUT}"
|
|
echo "::notice::${package_name}@${package_version} already exists on npm; skipping publish."
|
|
else
|
|
echo "already_published=false" >> "${GITHUB_OUTPUT}"
|
|
fi
|
|
|
|
- name: Show Trusted Publishing toolchain
|
|
if: steps.npm.outputs.already_published != 'true'
|
|
run: |
|
|
node --version
|
|
npm --version
|
|
|
|
- name: Publish MCP to npm
|
|
if: steps.npm.outputs.already_published != 'true'
|
|
working-directory: packages/mcp
|
|
# Authentication is supplied by npm Trusted Publishing through the
|
|
# GitHub OIDC token (permissions.id-token: write above).
|
|
run: npm publish --access public --provenance
|
|
|
|
- name: Summary
|
|
shell: bash
|
|
run: |
|
|
{
|
|
echo "## MCP npm publish"
|
|
echo
|
|
echo "| Key | Value |"
|
|
echo "| --- | --- |"
|
|
echo "| Package | \`${{ steps.npm.outputs.package_name }}\` |"
|
|
echo "| Version | \`${{ steps.npm.outputs.package_version }}\` |"
|
|
echo "| Already published | \`${{ steps.npm.outputs.already_published }}\` |"
|
|
echo "| Environment | \`SnowLuma\` |"
|
|
echo "| Authentication | npm Trusted Publishing (GitHub OIDC) |"
|
|
} >> "${GITHUB_STEP_SUMMARY}"
|