-
Notifications
You must be signed in to change notification settings - Fork 34
178 lines (160 loc) · 6.11 KB
/
release-waxmcp.yml
File metadata and controls
178 lines (160 loc) · 6.11 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Release waxmcp npm package
on:
workflow_dispatch:
inputs:
version:
description: Version bump (patch/minor/major) or semver (for manual release)
required: false
default: patch
push:
tags:
- "waxmcp-v*"
jobs:
build:
name: Build wax + wax-mcp (${{ matrix.platform }})
strategy:
fail-fast: false
matrix:
include:
- runs-on: macos-14
platform: darwin-x64
triple: x86_64-apple-macosx14.0
source_build: true
- runs-on: macos-14
platform: darwin-arm64
triple: arm64-apple-macosx14.0
source_build: true
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: swift-actions/setup-swift@v2
with:
swift-version: "6.2"
- name: Build binaries
if: ${{ matrix.source_build }}
run: |
set -euo pipefail
./Resources/scripts/build-waxmcp-binaries.sh "${{ matrix.platform }}" "${{ matrix.triple }}"
- name: Reuse checked-in binaries
if: ${{ !matrix.source_build }}
run: |
set -euo pipefail
./Resources/scripts/build-waxmcp-binaries.sh "${{ matrix.platform }}"
- name: Verify packaged binaries
run: |
set -euo pipefail
PLATFORM_DIR="Resources/npm/waxmcp/dist/${{ matrix.platform }}"
test -f "$PLATFORM_DIR/wax-cli"
test -f "$PLATFORM_DIR/wax-cli.sha256"
if command -v shasum >/dev/null 2>&1; then
shasum -a 256 -c "$PLATFORM_DIR/wax-cli.sha256"
else
sha256sum -c "$PLATFORM_DIR/wax-cli.sha256"
fi
# Verify wax-mcp binary exists (for source builds)
if [[ "${{ matrix.source_build }}" == "true" ]]; then
test -f "$PLATFORM_DIR/wax-mcp"
test -f "$PLATFORM_DIR/wax-mcp.sha256"
fi
test -d "$PLATFORM_DIR/Wax_WaxVectorSearchMiniLM.bundle"
echo "MiniLM bundle present"
- name: Smoke check MCP server
if: ${{ matrix.source-build }}
run: |
set -euo pipefail
Resources/npm/waxmcp/dist/${{ matrix.platform }}/wax-mcp --help
- name: Smoke check CLI entrypoint
if: ${{ matrix.source-build }}
run: |
set -euo pipefail
Resources/npm/waxmcp/dist/${{ matrix.platform }}/wax-cli mcp serve --help
- uses: actions/upload-artifact@v4
with:
name: waxmcp-${{ matrix.platform }}
path: Resources/npm/waxmcp/dist/${{ matrix.platform }}
if-no-files-found: error
publish:
name: Publish waxmcp to npm
needs: build
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref_name, 'waxmcp-v') }}
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Restore darwin-x64 binary
uses: actions/download-artifact@v4
with:
name: waxmcp-darwin-x64
path: Resources/npm/waxmcp/dist/darwin-x64
- name: Restore darwin-arm64 binary
uses: actions/download-artifact@v4
with:
name: waxmcp-darwin-arm64
path: Resources/npm/waxmcp/dist/darwin-arm64
- name: Set package version
working-directory: Resources/npm/waxmcp
run: |
set -euo pipefail
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
npm version "${VERSION}" --no-git-tag-version --allow-same-version
else
VERSION="${GITHUB_REF_NAME#waxmcp-v}"
npm version "${VERSION}" --no-git-tag-version --allow-same-version
fi
env:
VERSION: ${{ inputs.version }}
- name: Verify packaged binaries
run: |
set -euo pipefail
chmod +x Resources/npm/waxmcp/dist/darwin-arm64/wax-cli
test -x Resources/npm/waxmcp/dist/darwin-arm64/wax-cli
chmod +x Resources/npm/waxmcp/dist/darwin-x64/wax-cli
test -x Resources/npm/waxmcp/dist/darwin-x64/wax-cli
# Make wax-mcp executable if present
for arch in darwin-arm64 darwin-x64; do
if [[ -f "Resources/npm/waxmcp/dist/$arch/wax-mcp" ]]; then
chmod +x "Resources/npm/waxmcp/dist/$arch/wax-mcp"
test -x "Resources/npm/waxmcp/dist/$arch/wax-mcp"
fi
done
- name: Verify package integrity
run: |
set -euo pipefail
for arch in darwin-arm64 darwin-x64; do
for bin in wax-cli wax-mcp; do
chk="Resources/npm/waxmcp/dist/$arch/$bin.sha256"
if [[ -f "$chk" ]]; then
if command -v shasum >/dev/null 2>&1; then
shasum -a 256 -c "$chk"
else
sha256sum -c "$chk"
fi
fi
done
done
- name: Verify version consistency
run: |
set -euo pipefail
NPM_VERSION=$(node -p "require('./Resources/npm/waxmcp/package.json').version")
echo "npm package version: $NPM_VERSION"
# Extract the hardcoded version from main.swift and compare
SWIFT_VERSION=$(grep -E 'let serverVersion = "[0-9]+\.[0-9]+\.[0-9]+"' Sources/WaxMCPServer/main.swift | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
echo "Swift server version: $SWIFT_VERSION"
if [ "$NPM_VERSION" != "$SWIFT_VERSION" ]; then
echo "ERROR: version mismatch — npm=$NPM_VERSION swift=$SWIFT_VERSION"
echo "Update 'serverVersion' in Sources/WaxMCPServer/main.swift to match Resources/npm/waxmcp/package.json"
exit 1
fi
echo "Version consistency check passed: $NPM_VERSION"
- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Authenticate to npm
run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > "${HOME}/.npmrc"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish package
working-directory: Resources/npm/waxmcp
run: npm publish --access public