|
| 1 | +name: 🤖 Release MCP Server |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, release] |
| 6 | + paths: |
| 7 | + - 'packages/mcp/**' |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + release_type: |
| 11 | + description: 'Release type' |
| 12 | + required: true |
| 13 | + default: 'patch' |
| 14 | + type: choice |
| 15 | + options: |
| 16 | + - patch |
| 17 | + - minor |
| 18 | + - major |
| 19 | + |
| 20 | +permissions: |
| 21 | + contents: write |
| 22 | + packages: write |
| 23 | + id-token: write |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: release-mcp-${{ github.ref }} |
| 27 | + cancel-in-progress: false |
| 28 | + |
| 29 | +env: |
| 30 | + NODE_VERSION: '20' |
| 31 | + |
| 32 | +jobs: |
| 33 | + # Detect if release is needed |
| 34 | + detect-release: |
| 35 | + name: 🔍 Detect MCP Release |
| 36 | + runs-on: ubuntu-latest |
| 37 | + outputs: |
| 38 | + should_release: ${{ steps.check.outputs.should_release }} |
| 39 | + release_type: ${{ steps.check.outputs.release_type }} |
| 40 | + current_version: ${{ steps.check.outputs.current_version }} |
| 41 | + new_version: ${{ steps.check.outputs.new_version }} |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: 📥 Checkout repository |
| 45 | + uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + fetch-depth: 2 |
| 48 | + |
| 49 | + - name: 🔍 Check for release |
| 50 | + id: check |
| 51 | + run: | |
| 52 | + # Manual workflow dispatch |
| 53 | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
| 54 | + echo "should_release=true" >> $GITHUB_OUTPUT |
| 55 | + echo "release_type=${{ github.event.inputs.release_type }}" >> $GITHUB_OUTPUT |
| 56 | + echo "Manual release triggered: ${{ github.event.inputs.release_type }}" |
| 57 | + else |
| 58 | + # Check if mcp package changed |
| 59 | + CHANGED=$(git diff --name-only HEAD~1 HEAD | grep "^packages/mcp/" || true) |
| 60 | + if [ -n "$CHANGED" ]; then |
| 61 | + echo "should_release=true" >> $GITHUB_OUTPUT |
| 62 | + echo "release_type=patch" >> $GITHUB_OUTPUT |
| 63 | + echo "MCP package changes detected" |
| 64 | + else |
| 65 | + echo "should_release=false" >> $GITHUB_OUTPUT |
| 66 | + echo "No MCP changes detected" |
| 67 | + fi |
| 68 | + fi |
| 69 | +
|
| 70 | + # Get current version |
| 71 | + CURRENT_VERSION=$(node -p "require('./packages/mcp/package.json').version") |
| 72 | + echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT |
| 73 | +
|
| 74 | + # Calculate new version |
| 75 | + if [ "${{ github.event.inputs.release_type }}" = "major" ]; then |
| 76 | + NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{print $1+1".0.0"}') |
| 77 | + elif [ "${{ github.event.inputs.release_type }}" = "minor" ]; then |
| 78 | + NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{print $1"."$2+1".0"}') |
| 79 | + else |
| 80 | + NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{print $1"."$2"."$3+1}') |
| 81 | + fi |
| 82 | + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT |
| 83 | + echo "Version: $CURRENT_VERSION -> $NEW_VERSION" |
| 84 | +
|
| 85 | + # Build and test |
| 86 | + build: |
| 87 | + name: 🏗️ Build MCP Server |
| 88 | + runs-on: ubuntu-latest |
| 89 | + needs: detect-release |
| 90 | + if: needs.detect-release.outputs.should_release == 'true' |
| 91 | + |
| 92 | + steps: |
| 93 | + - name: 📥 Checkout repository |
| 94 | + uses: actions/checkout@v4 |
| 95 | + |
| 96 | + - name: 🔧 Setup Node.js |
| 97 | + uses: actions/setup-node@v4 |
| 98 | + with: |
| 99 | + node-version: ${{ env.NODE_VERSION }} |
| 100 | + |
| 101 | + - name: 📦 Install root dependencies |
| 102 | + run: npm install --legacy-peer-deps |
| 103 | + |
| 104 | + - name: 📦 Install MCP dependencies |
| 105 | + working-directory: packages/mcp |
| 106 | + run: npm install --legacy-peer-deps |
| 107 | + |
| 108 | + - name: 🏗️ Build package |
| 109 | + working-directory: packages/mcp |
| 110 | + run: | |
| 111 | + npm run build |
| 112 | + npm pack |
| 113 | +
|
| 114 | + - name: 💾 Upload build artifacts |
| 115 | + uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: mcp-package-${{ github.sha }} |
| 118 | + path: packages/mcp/*.tgz |
| 119 | + retention-days: 7 |
| 120 | + |
| 121 | + # Publish to npm |
| 122 | + publish-npm: |
| 123 | + name: 📦 Publish to npm |
| 124 | + runs-on: ubuntu-latest |
| 125 | + environment: npm-publish |
| 126 | + needs: [detect-release, build] |
| 127 | + if: needs.detect-release.outputs.should_release == 'true' |
| 128 | + |
| 129 | + steps: |
| 130 | + - name: 📥 Checkout repository |
| 131 | + uses: actions/checkout@v4 |
| 132 | + |
| 133 | + - name: 🔧 Setup Node.js |
| 134 | + uses: actions/setup-node@v4 |
| 135 | + with: |
| 136 | + node-version: ${{ env.NODE_VERSION }} |
| 137 | + registry-url: 'https://registry.npmjs.org' |
| 138 | + |
| 139 | + - name: 🔧 Upgrade npm for OIDC support |
| 140 | + run: npm install -g npm@latest |
| 141 | + |
| 142 | + - name: 📈 Bump version |
| 143 | + working-directory: packages/mcp |
| 144 | + run: | |
| 145 | + npm version ${{ needs.detect-release.outputs.new_version }} --no-git-tag-version |
| 146 | +
|
| 147 | + - name: 📦 Install and build |
| 148 | + working-directory: packages/mcp |
| 149 | + run: | |
| 150 | + npm install --legacy-peer-deps |
| 151 | + npm run build |
| 152 | +
|
| 153 | + - name: 🔍 Check if version exists |
| 154 | + id: check_version |
| 155 | + working-directory: packages/mcp |
| 156 | + run: | |
| 157 | + VERSION=${{ needs.detect-release.outputs.new_version }} |
| 158 | + if npm view glin-profanity-mcp@$VERSION version 2>/dev/null; then |
| 159 | + echo "exists=true" >> $GITHUB_OUTPUT |
| 160 | + echo "⚠️ Version $VERSION already exists on npm" |
| 161 | + else |
| 162 | + echo "exists=false" >> $GITHUB_OUTPUT |
| 163 | + echo "✅ Version $VERSION is available" |
| 164 | + fi |
| 165 | +
|
| 166 | + - name: 📦 Publish to npm |
| 167 | + if: steps.check_version.outputs.exists == 'false' |
| 168 | + working-directory: packages/mcp |
| 169 | + run: | |
| 170 | + # Using OIDC trusted publisher - no token needed |
| 171 | + # --provenance adds verified build attestation |
| 172 | + npm publish --provenance --access public |
| 173 | +
|
| 174 | + # Create GitHub release |
| 175 | + github-release: |
| 176 | + name: 🏷️ GitHub Release |
| 177 | + runs-on: ubuntu-latest |
| 178 | + needs: [detect-release, publish-npm] |
| 179 | + if: needs.detect-release.outputs.should_release == 'true' |
| 180 | + |
| 181 | + steps: |
| 182 | + - name: 📥 Checkout repository |
| 183 | + uses: actions/checkout@v4 |
| 184 | + with: |
| 185 | + fetch-depth: 0 |
| 186 | + |
| 187 | + - name: 📥 Download build artifacts |
| 188 | + uses: actions/download-artifact@v4 |
| 189 | + with: |
| 190 | + name: mcp-package-${{ github.sha }} |
| 191 | + path: ./artifacts/ |
| 192 | + |
| 193 | + - name: 🏷️ Create Git Tag |
| 194 | + run: | |
| 195 | + git config --local user.email "action@github.com" |
| 196 | + git config --local user.name "GitHub Action" |
| 197 | +
|
| 198 | + TAG_NAME="mcp-v${{ needs.detect-release.outputs.new_version }}" |
| 199 | +
|
| 200 | + if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then |
| 201 | + echo "⚠️ Tag $TAG_NAME already exists" |
| 202 | + else |
| 203 | + git tag $TAG_NAME |
| 204 | + git push origin $TAG_NAME |
| 205 | + echo "✅ Created tag $TAG_NAME" |
| 206 | + fi |
| 207 | +
|
| 208 | + - name: 📝 Generate Release Notes |
| 209 | + run: | |
| 210 | + VERSION="${{ needs.detect-release.outputs.new_version }}" |
| 211 | +
|
| 212 | + cat > release_notes.md << 'EOF' |
| 213 | + ## 🤖 Glin Profanity MCP Server v$VERSION |
| 214 | +
|
| 215 | + MCP (Model Context Protocol) server for AI assistants like Claude, Cursor, and Windsurf. |
| 216 | +
|
| 217 | + ### 📦 Installation |
| 218 | +
|
| 219 | + ```bash |
| 220 | + npm install -g glin-profanity-mcp |
| 221 | + ``` |
| 222 | +
|
| 223 | + ### ⚡ Quick Setup |
| 224 | +
|
| 225 | + **Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`): |
| 226 | + ```json |
| 227 | + { |
| 228 | + "mcpServers": { |
| 229 | + "glin-profanity": { |
| 230 | + "command": "npx", |
| 231 | + "args": ["-y", "glin-profanity-mcp"] |
| 232 | + } |
| 233 | + } |
| 234 | + } |
| 235 | + ``` |
| 236 | +
|
| 237 | + ### ✨ Features |
| 238 | +
|
| 239 | + - **12 Tools**: Check, censor, analyze, batch process profanity |
| 240 | + - **24 Languages**: Full multilingual support |
| 241 | + - **Streaming HTTP**: Real-time content moderation |
| 242 | + - **Context-Aware**: Domain-specific whitelists |
| 243 | + - **AI-Optimized**: Designed for LLM tool use |
| 244 | +
|
| 245 | + ### 🔗 Links |
| 246 | +
|
| 247 | + - [npm package](https://www.npmjs.com/package/glin-profanity-mcp) |
| 248 | + - [Documentation](https://github.com/GLINCKER/glin-profanity/tree/release/packages/mcp) |
| 249 | + - [glin-profanity core](https://www.npmjs.com/package/glin-profanity) |
| 250 | +
|
| 251 | + --- |
| 252 | +
|
| 253 | + 🤖 *This release was automatically generated* |
| 254 | + EOF |
| 255 | +
|
| 256 | + sed -i "s/\$VERSION/$VERSION/g" release_notes.md |
| 257 | +
|
| 258 | + - name: 🚀 Create GitHub Release |
| 259 | + uses: softprops/action-gh-release@v1 |
| 260 | + with: |
| 261 | + tag_name: mcp-v${{ needs.detect-release.outputs.new_version }} |
| 262 | + name: "glin-profanity-mcp v${{ needs.detect-release.outputs.new_version }}" |
| 263 | + body_path: release_notes.md |
| 264 | + draft: false |
| 265 | + prerelease: false |
| 266 | + files: ./artifacts/* |
| 267 | + env: |
| 268 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 269 | + |
| 270 | + # Summary |
| 271 | + summary: |
| 272 | + name: 📋 Release Summary |
| 273 | + runs-on: ubuntu-latest |
| 274 | + needs: [detect-release, publish-npm, github-release] |
| 275 | + if: always() && needs.detect-release.outputs.should_release == 'true' |
| 276 | + |
| 277 | + steps: |
| 278 | + - name: 📋 Summary |
| 279 | + run: | |
| 280 | + echo "## 🤖 MCP Server Release" >> $GITHUB_STEP_SUMMARY |
| 281 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 282 | + echo "**Package:** glin-profanity-mcp" >> $GITHUB_STEP_SUMMARY |
| 283 | + echo "**Version:** v${{ needs.detect-release.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY |
| 284 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 285 | + echo "### Status" >> $GITHUB_STEP_SUMMARY |
| 286 | + echo "- npm: ${{ needs.publish-npm.result == 'success' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY |
| 287 | + echo "- GitHub Release: ${{ needs.github-release.result == 'success' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY |
0 commit comments