feat: automate release workflow based on version file changes #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 and Release MCPB | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'server.json' | |
| - 'bundle/manifest.json' | |
| - 'package.json' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 1.0.5)' | |
| required: true | |
| type: string | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Get version from server.json | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| VERSION="${{ inputs.version }}" | |
| else | |
| VERSION=$(jq -r '.version' server.json) | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "TAG=v$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Check if tag exists | |
| id: check_tag | |
| run: | | |
| TAG="v${{ steps.version.outputs.VERSION }}" | |
| if git rev-parse "$TAG" >/dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Tag $TAG already exists, skipping release" | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "Tag $TAG does not exist, will create release" | |
| fi | |
| - name: Stop if tag exists | |
| if: steps.check_tag.outputs.exists == 'true' | |
| run: | | |
| echo "::notice::Tag v${{ steps.version.outputs.VERSION }} already exists. Skipping release." | |
| exit 0 | |
| - name: Sync version across files | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: | | |
| VERSION="${{ steps.version.outputs.VERSION }}" | |
| # Ensure all files have the same version | |
| sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" package.json | |
| sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" bundle/manifest.json | |
| sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" server.json | |
| echo "Synced version to $VERSION across all files" | |
| - name: Build MCPB bundle | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: | | |
| npm run build:mcpb | |
| - name: Verify MCPB file | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: | | |
| if [ ! -f dist/pfx-mcp-server.mcpb ]; then | |
| echo "Error: MCPB file not created" | |
| exit 1 | |
| fi | |
| FILE_SIZE=$(du -h dist/pfx-mcp-server.mcpb | cut -f1) | |
| echo "MCPB file size: $FILE_SIZE" | |
| # List contents of MCPB (it's a ZIP file) | |
| unzip -l dist/pfx-mcp-server.mcpb | |
| - name: Create Git Tag | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag -a "${{ steps.version.outputs.TAG }}" -m "Release ${{ steps.version.outputs.TAG }}" | |
| git push origin "${{ steps.version.outputs.TAG }}" | |
| - name: Create Release | |
| if: steps.check_tag.outputs.exists == 'false' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.version.outputs.TAG }} | |
| name: Release ${{ steps.version.outputs.TAG }} | |
| body: | | |
| ## Proffix Px5 MCP Server ${{ steps.version.outputs.VERSION }} | |
| ### 📦 Installation Options | |
| #### Option 1: One-Click Installation (Recommended) | |
| 1. Download `pfx-mcp-server.mcpb` below | |
| 2. Double-click the file to install in Claude Desktop | |
| 3. Configure your Proffix credentials in the UI | |
| #### Option 2: Manual Installation | |
| See [README.md](https://github.com/pitwch/pfx-mcp-server#readme) for manual setup instructions. | |
| ### 🔗 Links | |
| - **Documentation**: https://mcp.pfx.ch | |
| - **API Key Request**: https://mcp.pfx.ch/request-api-key.html | |
| - **Server Status**: https://mcp.pfx.ch/api/version | |
| ### 📋 What's Included | |
| - MCP HTTP Bridge script | |
| - Pre-configured manifest for Claude Desktop | |
| - Support for 120+ Proffix Px5 endpoints | |
| files: | | |
| dist/pfx-mcp-server.mcpb | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifact | |
| if: steps.check_tag.outputs.exists == 'false' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pfx-mcp-server-mcpb | |
| path: dist/pfx-mcp-server.mcpb | |
| retention-days: 90 |