Skip to content

Commit fbb48ed

Browse files
authored
Merge branch 'main' into fix_typo
2 parents 890e582 + 5e97e1a commit fbb48ed

File tree

109 files changed

+38439
-12576
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+38439
-12576
lines changed

.github/workflows/main.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
branches:
44
- main
55
pull_request:
6+
workflow_dispatch:
67
release:
78
types: [published]
89

@@ -18,19 +19,35 @@ jobs:
1819
- uses: actions/checkout@v4
1920
- uses: actions/setup-node@v4
2021
with:
21-
node-version: 18
22+
node-version: 24
2223
cache: npm
2324

2425
- run: npm ci
26+
- run: npm run check
2527
- run: npm run build
28+
29+
test:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
node-version: [18, 24]
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: ${{ matrix.node-version }}
41+
cache: npm
42+
43+
- run: npm ci
2644
- run: npm test
27-
- run: npm run lint
2845

2946
publish:
3047
runs-on: ubuntu-latest
3148
if: github.event_name == 'release'
3249
environment: release
33-
needs: build
50+
needs: [build, test]
3451

3552
permissions:
3653
contents: read
@@ -40,12 +57,22 @@ jobs:
4057
- uses: actions/checkout@v4
4158
- uses: actions/setup-node@v4
4259
with:
43-
node-version: 18
60+
node-version: 24
4461
cache: npm
4562
registry-url: 'https://registry.npmjs.org'
4663

4764
- run: npm ci
4865

49-
- run: npm publish --provenance --access public
66+
- name: Determine npm tag
67+
id: npm-tag
68+
run: |
69+
VERSION=$(node -p "require('./package.json').version")
70+
if [[ "$VERSION" == *"-beta"* ]]; then
71+
echo "tag=--tag beta" >> $GITHUB_OUTPUT
72+
else
73+
echo "tag=" >> $GITHUB_OUTPUT
74+
fi
75+
76+
- run: npm publish --provenance --access public ${{ steps.npm-tag.outputs.tag }}
5077
env:
5178
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Any Commit
2+
permissions:
3+
contents: read
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- '**'
9+
tags:
10+
- '!**'
11+
12+
jobs:
13+
pkg-publish:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 24
21+
cache: npm
22+
23+
- run: npm ci
24+
- name: Build
25+
run: npm run build
26+
- name: Publish
27+
run: npx pkg-pr-new publish
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Update Spec Types
2+
3+
on:
4+
schedule:
5+
# Run nightly at 4 AM UTC
6+
- cron: '0 4 * * *'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
update-spec-types:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '24'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Fetch latest spec types
29+
run: npm run fetch:spec-types
30+
31+
- name: Check for changes
32+
id: check_changes
33+
run: |
34+
if git diff --quiet src/spec.types.ts; then
35+
echo "has_changes=false" >> $GITHUB_OUTPUT
36+
else
37+
echo "has_changes=true" >> $GITHUB_OUTPUT
38+
LATEST_SHA=$(grep "Last updated from commit:" src/spec.types.ts | cut -d: -f2 | tr -d ' ')
39+
echo "sha=$LATEST_SHA" >> $GITHUB_OUTPUT
40+
fi
41+
42+
- name: Create Pull Request
43+
if: steps.check_changes.outputs.has_changes == 'true'
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
run: |
47+
git config user.name "github-actions[bot]"
48+
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
50+
git checkout -B update-spec-types
51+
git add src/spec.types.ts
52+
git commit -m "chore: update spec.types.ts from upstream"
53+
git push -f origin update-spec-types
54+
55+
# Create PR if it doesn't exist, or update if it does
56+
PR_BODY="This PR updates \`src/spec.types.ts\` from the Model Context Protocol specification.
57+
58+
Source file: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/${{ steps.check_changes.outputs.sha }}/schema/draft/schema.ts
59+
60+
This is an automated update triggered by the nightly cron job."
61+
62+
if gh pr view update-spec-types &>/dev/null; then
63+
echo "PR already exists, updating description..."
64+
gh pr edit update-spec-types --body "$PR_BODY"
65+
else
66+
gh pr create \
67+
--title "chore: update spec.types.ts from upstream" \
68+
--body "$PR_BODY" \
69+
--base main \
70+
--head update-spec-types
71+
fi

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ web_modules/
6969
# Output of 'npm pack'
7070
*.tgz
7171

72-
# Output of 'npm run fetch:spec-types'
73-
spec.types.ts
74-
7572
# Yarn Integrity file
7673
.yarn-integrity
7774

@@ -133,3 +130,6 @@ out
133130

134131
.DS_Store
135132
dist/
133+
134+
# IDE
135+
.idea/

.prettierignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ node_modules
77
**/build
88
**/dist
99
.github/CODEOWNERS
10-
pnpm-lock.yaml
10+
pnpm-lock.yaml
11+
12+
# Ignore generated files
13+
src/spec.types.ts

0 commit comments

Comments
 (0)