publish.yml•3.34 kB
name: Publish to NPM
on:
  push:
    tags:
      - "v*"
  workflow_dispatch:
jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      id-token: write
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "18"
          registry-url: "https://registry.npmjs.org"
      - name: Install dependencies
        run: npm ci
      - name: Download documentation
        run: node download-docs.js
      - name: Build package
        run: npm run build
      - name: Verify documentation
        run: |
          echo "Checking documentation files..."
          DOC_COUNT=$(ls docs/*.md 2>/dev/null | wc -l)
          echo "Found $DOC_COUNT documentation files"
          if [ "$DOC_COUNT" -lt 40 ]; then
            echo "Error: Expected at least 40 documentation files, found $DOC_COUNT"
            exit 1
          fi
          echo "✓ Documentation check passed"
      - name: Run tests
        run: npm test --if-present
      - name: Publish to NPM
        run: npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
      - name: Extract version from tag
        id: version
        run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
      - name: Create GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          tag_name: v${{ steps.version.outputs.VERSION }}
          name: Release v${{ steps.version.outputs.VERSION }}
          body: |
            ## MCP Modus v${{ steps.version.outputs.VERSION }}
            ### 🔒 Security & Reliability Improvements
            - **Pre-bundled Documentation**: All docs included with package - no runtime downloads
            - **Enhanced Security**: Removed postinstall hooks for safer installation
            - **Offline Operation**: Works completely offline after installation
            - **Verified Content**: Documentation verified during CI/CD process
            ### Features
            - 📚 **43 Modus Web Components** documented with complete API references
            - 🎨 **6 Design Rule categories** (colors, icons, spacing, typography, breakpoints, radius/stroke)
            - ⚙️ **5 Setup guides** (HTML, React, themes, testing, universal rules)
            - 🔧 **10 MCP tools** for comprehensive development support
            - 🖥️ **Multi-IDE support** (Claude Desktop, Cursor, VS Code)
            - 📱 **Secure offline operation** with bundled documentation
            ### Installation Options
            **Option 1: NPX (Recommended)**
            ```json
            {
              "mcpServers": {
                "modus-docs": {
                  "command": "npx",
                  "args": ["-y", "@julianoczkowski/mcp-modus"]
                }
              }
            }
            ```
            **Option 2: Global Install**
            ```bash
            npm install -g @julianoczkowski/mcp-modus
            ```
            ### Package Stats
            - 54 total documentation files (43 components + 6 rules + 5 setup)
            - ~80 KB compressed
            - ~350 KB unpacked
            - 10 MCP tools across 3 categories
          draft: false
          prerelease: false