Skip to content

Commit ffd99b0

Browse files
author
Jeremy Dai
authored
Merge branch 'main' into jeremy/tech-125-mcpm-improve-extraction-script-quality
2 parents edc599b + a51e32c commit ffd99b0

File tree

8 files changed

+2485
-33
lines changed

8 files changed

+2485
-33
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Semantic Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
issues: write
11+
pull-requests: write
12+
id-token: write # Required for PyPI trusted publishing
13+
14+
jobs:
15+
test:
16+
uses: ./.github/workflows/test.yml
17+
18+
release:
19+
name: Release
20+
needs: test
21+
runs-on: ubuntu-latest
22+
environment:
23+
name: pypi
24+
url: https://pypi.org/p/mcpm
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
persist-credentials: false
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Install pnpm
35+
uses: pnpm/action-setup@v4
36+
with:
37+
version: 8
38+
run_install: false
39+
40+
- name: Setup Node.js
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: 'lts/*'
44+
cache: 'pnpm'
45+
46+
- name: Install dependencies
47+
run: pnpm install
48+
49+
- name: Semantic Release
50+
id: semantic
51+
uses: cycjimmy/semantic-release-action@v4
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Install uv with caching
56+
if: steps.semantic.outputs.new_release_published == 'true'
57+
uses: astral-sh/setup-uv@v5
58+
with:
59+
enable-cache: true
60+
cache-dependency-glob: "pyproject.toml"
61+
62+
- name: Build
63+
if: steps.semantic.outputs.new_release_published == 'true'
64+
run: uv build
65+
66+
- name: Publish distribution to PyPI
67+
if: steps.semantic.outputs.new_release_published == 'true'
68+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/semver-check.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Semantic Version Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
semver-check:
9+
name: Validate Semantic Version
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
persist-credentials: false
21+
22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v4
24+
with:
25+
version: 8
26+
run_install: false
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 'lts/*'
32+
cache: 'pnpm'
33+
34+
- name: Install dependencies
35+
run: pnpm install
36+
37+
- name: Check Release
38+
uses: cycjimmy/semantic-release-action@v4
39+
with:
40+
dry_run: true
41+
ci: false
42+
unset_gha_env: true
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Comment PR
47+
if: always()
48+
uses: actions/github-script@v7
49+
with:
50+
script: |
51+
const semanticResult = process.env.SEMANTIC_OUTPUT;
52+
let comment = '## Semantic Version Check\n\n';
53+
54+
if (semanticResult && semanticResult.includes('The next release version is')) {
55+
const versionMatch = semanticResult.match(/The next release version is (.*)/);
56+
if (versionMatch) {
57+
comment += `✅ Valid semantic version changes detected!\n\n`;
58+
comment += `Next version will be: **${versionMatch[1]}**\n`;
59+
}
60+
} else {
61+
comment += `⚠️ No semantic version changes detected.\n\n`;
62+
comment += 'Please ensure your commits follow the [Conventional Commits](https://www.conventionalcommits.org/) format:\n\n';
63+
comment += '- `feat: new feature` (triggers MINOR version bump)\n';
64+
comment += '- `fix: bug fix` (triggers PATCH version bump)\n';
65+
comment += '- `BREAKING CHANGE: description` (triggers MAJOR version bump)\n';
66+
}
67+
68+
github.rest.issues.createComment({
69+
issue_number: context.issue.number,
70+
owner: context.repo.owner,
71+
repo: context.repo.repo,
72+
body: comment
73+
});

.github/workflows/test.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Test & Validate
2+
3+
on:
4+
pull_request:
5+
workflow_call:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
validate-manifests:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Validate Server JSON Files
19+
uses: cardinalby/schema-validator-action@v3
20+
with:
21+
file: 'mcp-registry/servers/*.json'
22+
schema: 'mcp-registry/schema/server-schema.json'
23+
mode: 'default'
24+
fixSchemas: false
25+
26+
test:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: '3.10'
34+
- name: Install uv
35+
uses: astral-sh/setup-uv@v5
36+
with:
37+
enable-cache: true
38+
- name: Run tests
39+
run: |
40+
uv sync --group dev
41+
uv run pytest
42+
43+
lint:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
- name: Set up Python
48+
uses: actions/setup-python@v5
49+
with:
50+
python-version: '3.10'
51+
- name: Install uv
52+
uses: astral-sh/setup-uv@v5
53+
with:
54+
enable-cache: true
55+
- name: Check code style with ruff
56+
run: |
57+
uv sync --group dev
58+
uv run ruff check src/ tests/

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,7 @@ _dev/
7373
.DS_Store
7474

7575
# folder
76-
local/
76+
local/
77+
78+
# node
79+
node_modules/

.releaserc.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"branches": [
3+
"main",
4+
"master"
5+
],
6+
"plugins": [
7+
"@semantic-release/commit-analyzer",
8+
"@semantic-release/release-notes-generator",
9+
"@semantic-release/changelog",
10+
[
11+
"@semantic-release/exec",
12+
{
13+
"prepareCmd": "echo '__version__ = \"${nextRelease.version}\"' > src/mcpm/version.py"
14+
}
15+
],
16+
[
17+
"@semantic-release/git",
18+
{
19+
"assets": [
20+
"CHANGELOG.md",
21+
"src/mcpm/version.py"
22+
],
23+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
24+
}
25+
]
26+
]
27+
}

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "mcpm",
3+
"private": true,
4+
"devDependencies": {
5+
"@semantic-release/changelog": "^6.0.3",
6+
"@semantic-release/commit-analyzer": "^11.1.0",
7+
"@semantic-release/exec": "^6.0.3",
8+
"@semantic-release/git": "^10.0.1",
9+
"@semantic-release/github": "^9.2.6",
10+
"@semantic-release/release-notes-generator": "^12.1.0",
11+
"semantic-release": "^22.0.12"
12+
}
13+
}

0 commit comments

Comments
 (0)