-
Notifications
You must be signed in to change notification settings - Fork 84
148 lines (124 loc) · 5.21 KB
/
Copy pathmcpb-pack.yaml
File metadata and controls
148 lines (124 loc) · 5.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Release MCPB
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Enable corepack
run: corepack enable
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Resolve release tag
id: release-tag
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
else
tag=$(gh release view --json tagName -q .tagName)
echo "tag=$tag" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Sync manifest versions with package.json
run: |
pkg_version=$(jq -r .version package.json)
jq --arg v "$pkg_version" '.version = $v' manifest-minimal.json > manifest-minimal.tmp.json
mv manifest-minimal.tmp.json manifest-minimal.json
jq --arg v "$pkg_version" '.version = $v' manifest-full.json > manifest-full.tmp.json
mv manifest-full.tmp.json manifest-full.json
jq --arg v "$pkg_version" '.version = $v' manifest-code.json > manifest-code.tmp.json
mv manifest-code.tmp.json manifest-code.json
jq --arg v "$pkg_version" '.version = $v' manifest-learn.json > manifest-learn.tmp.json
mv manifest-learn.tmp.json manifest-learn.json
- name: Build project
run: pnpm run build
- name: Install dependencies for packaging
run: |
rm -rf node_modules
pnpm install --frozen-lockfile --prod
- name: Install MCPB
run: npm install -g @anthropic-ai/mcpb
- name: Package extensions
run: |
current_dir=$(basename "$PWD")
# Package minimal version
cp manifest-minimal.json manifest.json
mcpb pack
mv "${current_dir}.mcpb" "${current_dir}-minimal.mcpb"
# Package full version
cp manifest-full.json manifest.json
mcpb pack
mv "${current_dir}.mcpb" "${current_dir}-full.mcpb"
# Package code version
cp manifest-code.json manifest.json
mcpb pack
mv "${current_dir}.mcpb" "${current_dir}-code.mcpb"
# Package learn version
cp manifest-learn.json manifest.json
mcpb pack
mv "${current_dir}.mcpb" "${current_dir}-learn.mcpb"
# Set environment variables
echo "MCPB_MINIMAL_FILENAME=${current_dir}-minimal.mcpb" >> $GITHUB_ENV
echo "MCPB_FULL_FILENAME=${current_dir}-full.mcpb" >> $GITHUB_ENV
echo "MCPB_CODE_FILENAME=${current_dir}-code.mcpb" >> $GITHUB_ENV
echo "MCPB_LEARN_FILENAME=${current_dir}-learn.mcpb" >> $GITHUB_ENV
- name: Upload minimal release asset
uses: svenstaro/upload-release-action@7027b7670c56b9473901daad1fb8a09ab534688e
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.MCPB_MINIMAL_FILENAME }}
asset_name: ${{ env.MCPB_MINIMAL_FILENAME }}
tag: ${{ steps.release-tag.outputs.tag }}
overwrite: true
- name: Upload full release asset
uses: svenstaro/upload-release-action@7027b7670c56b9473901daad1fb8a09ab534688e
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.MCPB_FULL_FILENAME }}
asset_name: ${{ env.MCPB_FULL_FILENAME }}
tag: ${{ steps.release-tag.outputs.tag }}
overwrite: true
- name: Upload code release asset
uses: svenstaro/upload-release-action@7027b7670c56b9473901daad1fb8a09ab534688e
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.MCPB_CODE_FILENAME }}
asset_name: ${{ env.MCPB_CODE_FILENAME }}
tag: ${{ steps.release-tag.outputs.tag }}
overwrite: true
- name: Upload learn release asset
uses: svenstaro/upload-release-action@7027b7670c56b9473901daad1fb8a09ab534688e
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.MCPB_LEARN_FILENAME }}
asset_name: ${{ env.MCPB_LEARN_FILENAME }}
tag: ${{ steps.release-tag.outputs.tag }}
overwrite: true
publish-mcp:
if: github.event_name != 'workflow_dispatch'
needs: build-and-release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install MCP Publisher
run: |
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz
chmod +x mcp-publisher
- name: Login to MCP Registry
run: |
echo "${{ secrets.MCP_PRIVATE_KEY }}" > key.pem
./mcp-publisher login dns --domain postman.com --private-key $(openssl pkey -in key.pem -noout -text | grep -A3 "priv:" | tail -n +2 | tr -d ' :\n')
- name: Publish to MCP Registry
run: ./mcp-publisher publish