Build MCPB Bundle #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Build MCPB Bundle" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag/Release to upload the MCPB bundle to (e.g., 1.0.0)' | |
| required: false | |
| type: string | |
| push: | |
| tags: | |
| - '*' | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-mcpb: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Checkout source code" | |
| uses: actions/checkout@v4 | |
| - name: "Set up Node.js" | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| - name: "Install dependencies" | |
| run: npm ci | |
| - name: "Build the project" | |
| run: npm run build | |
| - name: "Install MCPB CLI" | |
| run: npm install -g @anthropic-ai/mcpb | |
| - name: "Validate manifest.json" | |
| run: | | |
| if [ ! -f "manifest.json" ]; then | |
| echo "Error: manifest.json not found" | |
| exit 1 | |
| fi | |
| echo "manifest.json found, validating..." | |
| cat manifest.json | jq '.' > /dev/null | |
| echo "manifest.json is valid JSON" | |
| - name: "Pack MCPB bundle" | |
| run: mcpb pack | |
| - name: "Get version from package.json" | |
| id: get_version | |
| run: | | |
| VERSION="$(node -p 'require("./package.json").version')" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: "List generated files" | |
| run: | | |
| echo "Looking for .mcpb files..." | |
| ls -lah *.mcpb || echo "No .mcpb files found in root" | |
| find . -name "*.mcpb" -type f | |
| - name: "Upload MCPB bundle as artifact" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: testingbot-mcp-server-${{ steps.get_version.outputs.version }}.mcpb | |
| path: "*.mcpb" | |
| if-no-files-found: error | |
| - name: "Upload MCPB to GitHub Release" | |
| if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: "*.mcpb" | |
| fail_on_unmatched_files: true | |
| tag_name: ${{ github.event.inputs.tag || github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |