Skip to content

Commit 3da9821

Browse files
authored
Merge branch 'main' into windows-default-encoding-fix
2 parents 71f0b3c + aecbde5 commit 3da9821

File tree

36 files changed

+2239
-1707
lines changed

36 files changed

+2239
-1707
lines changed

.github/workflows/release.yml

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
name: Automatic Release Creation
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 10 * * *'
7+
8+
jobs:
9+
create-metadata:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
hash: ${{ steps.last-release.outputs.hash }}
13+
version: ${{ steps.create-version.outputs.version}}
14+
npm_packages: ${{ steps.create-npm-packages.outputs.npm_packages}}
15+
pypi_packages: ${{ steps.create-pypi-packages.outputs.pypi_packages}}
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Get last release hash
22+
id: last-release
23+
run: |
24+
HASH=$(git rev-list --tags --max-count=1 || echo "HEAD~1")
25+
echo "hash=${HASH}" >> $GITHUB_OUTPUT
26+
echo "Using last release hash: ${HASH}"
27+
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v5
30+
31+
- name: Create version name
32+
id: create-version
33+
run: |
34+
VERSION=$(uv run --script scripts/release.py generate-version)
35+
echo "version $VERSION"
36+
echo "version=$VERSION" >> $GITHUB_OUTPUT
37+
38+
- name: Create notes
39+
run: |
40+
HASH="${{ steps.last-release.outputs.hash }}"
41+
uv run --script scripts/release.py generate-notes --directory src/ $HASH > RELEASE_NOTES.md
42+
cat RELEASE_NOTES.md
43+
44+
- name: Release notes
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: release-notes
48+
path: RELEASE_NOTES.md
49+
50+
- name: Create python matrix
51+
id: create-pypi-packages
52+
run: |
53+
HASH="${{ steps.last-release.outputs.hash }}"
54+
PYPI=$(uv run --script scripts/release.py generate-matrix --pypi --directory src $HASH)
55+
echo "pypi_packages $PYPI"
56+
echo "pypi_packages=$PYPI" >> $GITHUB_OUTPUT
57+
58+
- name: Create npm matrix
59+
id: create-npm-packages
60+
run: |
61+
HASH="${{ steps.last-release.outputs.hash }}"
62+
NPM=$(uv run --script scripts/release.py generate-matrix --npm --directory src $HASH)
63+
echo "npm_packages $NPM"
64+
echo "npm_packages=$NPM" >> $GITHUB_OUTPUT
65+
66+
update-packages:
67+
needs: [create-metadata]
68+
if: ${{ needs.create-metadata.outputs.npm_packages != '[]' || needs.create-metadata.outputs.pypi_packages != '[]' }}
69+
runs-on: ubuntu-latest
70+
outputs:
71+
changes_made: ${{ steps.commit.outputs.changes_made }}
72+
steps:
73+
- uses: actions/checkout@v4
74+
with:
75+
fetch-depth: 0
76+
77+
- name: Install uv
78+
uses: astral-sh/setup-uv@v5
79+
80+
- name: Update packages
81+
run: |
82+
HASH="${{ needs.create-metadata.outputs.hash }}"
83+
uv run --script scripts/release.py update-packages --directory src/ $HASH
84+
85+
- name: Configure git
86+
run: |
87+
git config --global user.name "GitHub Actions"
88+
git config --global user.email "[email protected]"
89+
90+
- name: Commit changes
91+
id: commit
92+
run: |
93+
VERSION="${{ needs.create-metadata.outputs.version }}"
94+
git add -u
95+
if git diff-index --quiet HEAD; then
96+
echo "changes_made=false" >> $GITHUB_OUTPUT
97+
else
98+
git commit -m 'Automatic update of packages'
99+
git tag -a "$VERSION" -m "Release $VERSION"
100+
git push origin "$VERSION"
101+
echo "changes_made=true" >> $GITHUB_OUTPUT
102+
fi
103+
104+
publish-pypi:
105+
needs: [update-packages, create-metadata]
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
package: ${{ fromJson(needs.create-metadata.outputs.pypi_packages) }}
110+
name: Build ${{ matrix.package }}
111+
environment: release
112+
permissions:
113+
id-token: write # Required for trusted publishing
114+
runs-on: ubuntu-latest
115+
steps:
116+
- uses: actions/checkout@v4
117+
with:
118+
ref: ${{ needs.create-metadata.outputs.version }}
119+
120+
- name: Install uv
121+
uses: astral-sh/setup-uv@v5
122+
123+
- name: Set up Python
124+
uses: actions/setup-python@v5
125+
with:
126+
python-version-file: "src/${{ matrix.package }}/.python-version"
127+
128+
- name: Install dependencies
129+
working-directory: src/${{ matrix.package }}
130+
run: uv sync --frozen --all-extras --dev
131+
132+
- name: Run pyright
133+
working-directory: src/${{ matrix.package }}
134+
run: uv run --frozen pyright
135+
136+
- name: Build package
137+
working-directory: src/${{ matrix.package }}
138+
run: uv build
139+
140+
- name: Publish package to PyPI
141+
uses: pypa/gh-action-pypi-publish@release/v1
142+
with:
143+
packages-dir: src/${{ matrix.package }}/dist
144+
145+
publish-npm:
146+
needs: [update-packages, create-metadata]
147+
strategy:
148+
fail-fast: false
149+
matrix:
150+
package: ${{ fromJson(needs.create-metadata.outputs.npm_packages) }}
151+
name: Build ${{ matrix.package }}
152+
environment: release
153+
runs-on: ubuntu-latest
154+
steps:
155+
- uses: actions/checkout@v4
156+
with:
157+
ref: ${{ needs.create-metadata.outputs.version }}
158+
159+
- uses: actions/setup-node@v4
160+
with:
161+
node-version: 22
162+
cache: npm
163+
registry-url: 'https://registry.npmjs.org'
164+
165+
- name: Install dependencies
166+
working-directory: src/${{ matrix.package }}
167+
run: npm ci
168+
169+
- name: Check if version exists on npm
170+
working-directory: src/${{ matrix.package }}
171+
run: |
172+
VERSION=$(jq -r .version package.json)
173+
if npm view --json | jq --arg version "$VERSION" '[.[]][0].versions | contains([$version])'; then
174+
echo "Version $VERSION already exists on npm"
175+
exit 1
176+
fi
177+
echo "Version $VERSION is new, proceeding with publish"
178+
179+
- name: Build package
180+
working-directory: src/${{ matrix.package }}
181+
run: npm run build
182+
183+
- name: Publish package
184+
working-directory: src/${{ matrix.package }}
185+
run: |
186+
npm publish --access public
187+
env:
188+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
189+
190+
create-release:
191+
needs: [update-packages, create-metadata, publish-pypi, publish-npm]
192+
if: needs.update-packages.outputs.changes_made == 'true'
193+
runs-on: ubuntu-latest
194+
environment: release
195+
permissions:
196+
contents: write
197+
steps:
198+
- uses: actions/checkout@v4
199+
200+
- name: Download release notes
201+
uses: actions/download-artifact@v4
202+
with:
203+
name: release-notes
204+
205+
- name: Create release
206+
env:
207+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN}}
208+
run: |
209+
VERSION="${{ needs.create-metadata.outputs.version }}"
210+
gh release create "$VERSION" \
211+
--title "Release $VERSION" \
212+
--notes-file RELEASE_NOTES.md

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ The repository contains reference implementations, as well as a list of communit
1010
We generally don't accept new servers into the repository. We do accept pull requests to the [README.md](./README.md)
1111
adding a reference to your servers.
1212

13+
Please keep lists in alphabetical order to minimize merge conflicts when adding new items.
14+
1315
- Check the [modelcontextprotocol.io](https://modelcontextprotocol.io) documentation
1416
- Ensure your server doesn't duplicate existing functionality
1517
- Consider whether your server would be generally useful to others

0 commit comments

Comments
 (0)