Skip to content

Commit 4b14e07

Browse files
Merge branch 'main' into main
2 parents b5eda4a + e42a6ac commit 4b14e07

File tree

39 files changed

+2296
-1715
lines changed

39 files changed

+2296
-1715
lines changed

.github/workflows/release.yml

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
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+
environment: release
71+
outputs:
72+
changes_made: ${{ steps.commit.outputs.changes_made }}
73+
steps:
74+
- uses: actions/checkout@v4
75+
with:
76+
fetch-depth: 0
77+
78+
- name: Install uv
79+
uses: astral-sh/setup-uv@v5
80+
81+
- name: Update packages
82+
run: |
83+
HASH="${{ needs.create-metadata.outputs.hash }}"
84+
uv run --script scripts/release.py update-packages --directory src/ $HASH
85+
86+
- name: Configure git
87+
run: |
88+
git config --global user.name "GitHub Actions"
89+
git config --global user.email "[email protected]"
90+
91+
- name: Commit changes
92+
id: commit
93+
run: |
94+
VERSION="${{ needs.create-metadata.outputs.version }}"
95+
git add -u
96+
if git diff-index --quiet HEAD; then
97+
echo "changes_made=false" >> $GITHUB_OUTPUT
98+
else
99+
git commit -m 'Automatic update of packages'
100+
git tag -a "$VERSION" -m "Release $VERSION"
101+
git push origin "$VERSION"
102+
echo "changes_made=true" >> $GITHUB_OUTPUT
103+
fi
104+
105+
publish-pypi:
106+
needs: [update-packages, create-metadata]
107+
strategy:
108+
fail-fast: false
109+
matrix:
110+
package: ${{ fromJson(needs.create-metadata.outputs.pypi_packages) }}
111+
name: Build ${{ matrix.package }}
112+
environment: release
113+
permissions:
114+
id-token: write # Required for trusted publishing
115+
runs-on: ubuntu-latest
116+
steps:
117+
- uses: actions/checkout@v4
118+
with:
119+
ref: ${{ needs.create-metadata.outputs.version }}
120+
121+
- name: Install uv
122+
uses: astral-sh/setup-uv@v5
123+
124+
- name: Set up Python
125+
uses: actions/setup-python@v5
126+
with:
127+
python-version-file: "src/${{ matrix.package }}/.python-version"
128+
129+
- name: Install dependencies
130+
working-directory: src/${{ matrix.package }}
131+
run: uv sync --frozen --all-extras --dev
132+
133+
- name: Run pyright
134+
working-directory: src/${{ matrix.package }}
135+
run: uv run --frozen pyright
136+
137+
- name: Build package
138+
working-directory: src/${{ matrix.package }}
139+
run: uv build
140+
141+
- name: Publish package to PyPI
142+
uses: pypa/gh-action-pypi-publish@release/v1
143+
with:
144+
packages-dir: src/${{ matrix.package }}/dist
145+
146+
publish-npm:
147+
needs: [update-packages, create-metadata]
148+
strategy:
149+
fail-fast: false
150+
matrix:
151+
package: ${{ fromJson(needs.create-metadata.outputs.npm_packages) }}
152+
name: Build ${{ matrix.package }}
153+
environment: release
154+
runs-on: ubuntu-latest
155+
steps:
156+
- uses: actions/checkout@v4
157+
with:
158+
ref: ${{ needs.create-metadata.outputs.version }}
159+
160+
- uses: actions/setup-node@v4
161+
with:
162+
node-version: 22
163+
cache: npm
164+
registry-url: 'https://registry.npmjs.org'
165+
166+
- name: Install dependencies
167+
working-directory: src/${{ matrix.package }}
168+
run: npm ci
169+
170+
- name: Check if version exists on npm
171+
working-directory: src/${{ matrix.package }}
172+
run: |
173+
VERSION=$(jq -r .version package.json)
174+
if npm view --json | jq -e --arg version "$VERSION" '[.[]][0].versions | contains([$version])'; then
175+
echo "Version $VERSION already exists on npm"
176+
exit 1
177+
fi
178+
echo "Version $VERSION is new, proceeding with publish"
179+
180+
- name: Build package
181+
working-directory: src/${{ matrix.package }}
182+
run: npm run build
183+
184+
- name: Publish package
185+
working-directory: src/${{ matrix.package }}
186+
run: |
187+
npm publish --access public
188+
env:
189+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
190+
191+
create-release:
192+
needs: [update-packages, create-metadata, publish-pypi, publish-npm]
193+
if: needs.update-packages.outputs.changes_made == 'true'
194+
runs-on: ubuntu-latest
195+
environment: release
196+
permissions:
197+
contents: write
198+
steps:
199+
- uses: actions/checkout@v4
200+
201+
- name: Download release notes
202+
uses: actions/download-artifact@v4
203+
with:
204+
name: release-notes
205+
206+
- name: Create release
207+
env:
208+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN}}
209+
run: |
210+
VERSION="${{ needs.create-metadata.outputs.version }}"
211+
gh release create "$VERSION" \
212+
--title "Release $VERSION" \
213+
--notes-file RELEASE_NOTES.md
214+
215+
- name: Docker MCP images
216+
uses: peter-evans/repository-dispatch@v3
217+
with:
218+
token: ${{ secrets.DOCKER_TOKEN }}
219+
repository: docker/labs-ai-tools-for-devs
220+
event-type: build-mcp-images
221+
client-payload: '{"ref": "${{ needs.create-metadata.outputs.version }}"}'

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)