Skip to main content
Glama

ContextEngine MCP Server

publishing-workflow.mdโ€ข12.9 kB
# ๐Ÿ“ฆ **Automated Publishing Workflow for ContextEngine MCP** ## **๐ŸŽฏ Overview** This workflow automates the entire publishing process through GitHub Actions, ensuring consistent, safe releases with minimal manual intervention. --- ## **๐Ÿ”„ Automated Workflow** ### **Phase 1: Development & Automated Testing** #### **Step 1: Create Feature Branch** ```bash git checkout -b feature/your-feature-name # or git checkout -b fix/your-fix-name ``` #### **Step 2: Make Changes & Push** ```bash # Make your changes git add . git commit -m "feat: add new feature description" git push origin feature/your-feature-name ``` #### **Step 3: Automated CI/CD Pipeline** - **GitHub Actions automatically runs**: - โœ… All tests (`npm run test:run`) - โœ… Build validation (`npm run build`) - โœ… Linting (`npm run lint`) - โœ… Type checking (`npm run type-check`) - โœ… Security audit (`npm audit`) - โœ… Coverage reporting - โœ… Performance tests #### **Step 4: Pull Request Review** - **Automated checks must pass** - **Code review required** - **Merge to master** --- ### **Phase 2: Automated Release Process** #### **Step 5: Create GitHub Release** 1. **Check package.json version**: `npm run version --silent` (e.g., `1.0.0`) 2. **Go to GitHub โ†’ Releases โ†’ "Create a new release"** 3. **Tag**: `v1.0.0` (must match package.json version with 'v' prefix) 4. **Title**: `Release v1.0.0` 5. **Description**: Add release notes 6. **Publish release** #### **Step 6: Automated Publishing Pipeline** **GitHub Actions automatically:** - โœ… **Runs pre-publish validation** (`npm run pre-publish`) - โœ… **Builds the project** (`npm run build`) - โœ… **Runs all tests** (`npm run test:run`) - โœ… **Publishes to npm** (`npm publish`) - โœ… **Verifies publication** (`npm view context-engine`) - โœ… **Tests installation** (`npm install -g context-engine`) - โœ… **Tests execution** (`context-engine --help`) - โœ… **Sends notifications** --- ### **Phase 3: Post-Release Verification** #### **Step 7: Automated Verification** - **Package available on npm**: https://www.npmjs.com/package/context-engine - **Installation tested**: `npm install -g context-engine` - **Execution tested**: `context-engine --help` - **Release notes published**: GitHub release page --- ## **๐Ÿš€ Quick Release Commands** ### **For Bug Fixes (Patch Release):** ```bash # 1. Create release branch git checkout -b release/v1.0.1 # 2. Update version npm version patch # 3. Push and create PR git push origin release/v1.0.1 # Create PR, review, merge # 4. Check version and create GitHub release npm run version --silent # e.g., outputs: 1.0.1 # Go to GitHub โ†’ Releases โ†’ Create v1.0.1 (must match package.json) # GitHub Actions will automatically publish to npm ``` ### **For New Features (Minor Release):** ```bash # 1. Create release branch git checkout -b release/v1.1.0 # 2. Update version npm version minor # 3. Push and create PR git push origin release/v1.1.0 # Create PR, review, merge # 4. Check version and create GitHub release npm run version --silent # e.g., outputs: 1.1.0 # Go to GitHub โ†’ Releases โ†’ Create v1.1.0 (must match package.json) # GitHub Actions will automatically publish to npm ``` ### **For Breaking Changes (Major Release):** ```bash # 1. Create release branch git checkout -b release/v2.0.0 # 2. Update version npm version major # 3. Push and create PR git push origin release/v2.0.0 # Create PR, review, merge # 4. Check version and create GitHub release npm run version --silent # e.g., outputs: 2.0.0 # Go to GitHub โ†’ Releases โ†’ Create v2.0.0 (must match package.json) # GitHub Actions will automatically publish to npm ``` ### **For Release Candidates (RC):** ```bash # 1. Create RC branch git checkout -b release/v2.0.0-rc.1 # 2. Update version with RC suffix npm version prerelease --preid=rc # e.g., 2.0.0 โ†’ 2.0.0-rc.1 # 3. Push and create PR git push origin release/v2.0.0-rc.1 # Create PR, review, merge # 4. Check version and create GitHub release npm run version --silent # e.g., outputs: 2.0.0-rc.1 # Go to GitHub โ†’ Releases โ†’ Create v2.0.0-rc.1 (must match package.json) # GitHub Actions will automatically publish to npm with RC tag ``` --- ## **๐Ÿ”ง Manual Override (If Needed)** ### **Emergency Manual Publishing:** ```bash # Only use if automated pipeline fails npm run pre-publish # Run all checks npm publish # Publish manually git tag v$(npm run version --silent) git push origin --tags ``` ## **๐ŸŽฏ Release Candidate (RC) Workflow** ### **RC Publishing Behavior:** - **RC versions** are published to npm with `--tag rc` - **Users can install** with: `npm install context-engine@rc` - **Default installs** still get the latest stable version - **RC versions** don't affect the `latest` tag ### **RC Release Process:** ```bash # 1. Create RC branch git checkout -b release/v2.0.0-rc.1 # 2. Update version to RC npm version prerelease --preid=rc # 2.0.0 โ†’ 2.0.0-rc.1 # 3. Push and create PR git push origin release/v2.0.0-rc.1 # Create PR, review, merge # 4. Create GitHub release npm run version --silent # Check: 2.0.0-rc.1 # Go to GitHub โ†’ Releases โ†’ Create v2.0.0-rc.1 # GitHub Actions publishes with RC tag ``` ### **Testing RC Releases:** ```bash # Install RC version npm install context-engine@rc # Test RC functionality context-engine --help # Install specific RC version npm install context-engine@2.0.0-rc.1 ``` ### **Promoting RC to Stable:** ```bash # 1. Create stable release branch git checkout -b release/v2.0.0 # 2. Update to stable version (remove RC suffix) npm version patch # or minor/major as needed # 3. Push and create PR git push origin release/v2.0.0 # Create PR, review, merge # 4. Create stable GitHub release npm run version --silent # Check: 2.0.0 # Go to GitHub โ†’ Releases โ†’ Create v2.0.0 # GitHub Actions publishes to latest tag ``` ## **โš ๏ธ Demoting Stable to RC (Emergency)** ### **When to Demote:** - Critical bugs found after release - Security vulnerabilities discovered - Breaking changes that weren't caught in testing ### **Automated Demotion Process:** ```bash # Use the automated script npm run demote-to-rc 1.0.0 "Critical bug found in API response" # Or run manually ./scripts/demote-to-rc.sh 1.0.0 "Critical bug found in API response" ``` ### **What the Script Does:** 1. **Deprecates** the problematic stable version 2. **Creates** a new RC version 3. **Publishes** RC with proper tags 4. **Updates** latest tag to point to RC 5. **Creates** a PR for review ### **Manual Demotion (If Needed):** ```bash # 1. Deprecate current version npm deprecate context-engine@1.0.0 "Critical bug found. Use RC version." # 2. Create RC version npm version prerelease --preid=rc # 3. Publish RC npm publish --tag rc # 4. Update latest tag npm dist-tag add context-engine@1.0.0-rc.1 latest ``` --- ## **๐Ÿ“‹ Automated Checks** ### **Pre-Publish Validation (Automatic):** - [ ] **All tests pass** (123 tests) - [ ] **Build successful** (TypeScript compilation) - [ ] **Linting passes** (ESLint) - [ ] **Type checking passes** (TypeScript) - [ ] **Coverage meets threshold** (80%+) - [ ] **Security audit passes** (npm audit) - [ ] **On master branch** - [ ] **Working directory clean** - [ ] **Logged into npm** - [ ] **Package name correct** (`context-engine`) - [ ] **Repository URLs correct** - [ ] **No sensitive data** - [ ] **README.md included** - [ ] **dist/ folder included** ### **Post-Publish Verification (Automatic):** - [ ] **Package published successfully** - [ ] **Installation tested** - [ ] **Execution tested** - [ ] **Release notes published** --- ## **๐ŸŽฏ GitHub Actions Workflows** ### **1. Test Workflow** (`.github/workflows/test.yml`) - **Triggers**: Push to master, Pull requests - **Runs**: Tests, linting, type checking, security audit - **Matrix**: Node.js 18.x, 20.x, 22.x ### **2. Publish Workflow** (`.github/workflows/publish.yml`) - **Triggers**: GitHub release published - **Runs**: Pre-publish checks, npm publish, verification - **Requires**: NPM_TOKEN secret --- ## **๐Ÿ” Required Setup** ### **GitHub Secrets:** - `NPM_TOKEN`: Your npm authentication token ### **Branch Protection:** - **Require pull request reviews** - **Require status checks to pass** - **Restrict pushes to master** --- ## **๐Ÿ“Š Release Dashboard** ### **Automated Release Process:** 1. **Create GitHub Release** โ†’ Triggers workflow 2. **Pre-publish validation** โ†’ Ensures quality 3. **NPM publication** โ†’ Publishes to registry 4. **Installation verification** โ†’ Tests package 5. **Notification** โ†’ Confirms success ### **Release Timeline:** - **GitHub Release**: 30 seconds - **Pre-publish checks**: 2-3 minutes - **NPM publication**: 1 minute - **Verification**: 1 minute - **Total time**: ~5 minutes --- ## **๐Ÿšจ Emergency Procedures** ### **If Automated Publishing Fails:** 1. **Check GitHub Actions logs** 2. **Fix issues in code** 3. **Create new release** 4. **Re-run workflow** ### **If Published by Mistake:** ```bash # Within 72 hours npm unpublish context-engine@version # After 72 hours npm deprecate context-engine@version "Published by mistake" ``` --- ## **โœ… Success Criteria** A successful automated release means: - โœ… **All CI/CD checks pass automatically** - โœ… **GitHub release created** - โœ… **Package published to npm automatically** - โœ… **Installation verified automatically** - โœ… **Execution tested automatically** - โœ… **Release notes published** - โœ… **No manual intervention required** **This automated workflow ensures consistent, reliable npm publishing with minimal manual steps!** --- ## **๐Ÿšจ Safety Checks** ### **Before Publishing Checklist** - [ ] **All tests pass** (`npm run test:run`) - [ ] **Build successful** (`npm run build`) - [ ] **No linting errors** (`npm run lint`) - [ ] **Type checking passes** (`npm run type-check`) - [ ] **Coverage meets threshold** (80%+) - [ ] **Security audit passes** (`npm audit`) - [ ] **Version updated** (`npm version`) - [ ] **Documentation updated** - [ ] **Package name correct** (`context-engine`) - [ ] **Repository URLs correct** - [ ] **No sensitive data** (API keys, passwords) - [ ] **README.md included** - [ ] **dist/ folder included** ### **Emergency Procedures** #### **If Published by Mistake:** ```bash # Within 72 hours - Unpublish npm unpublish context-engine@version # After 72 hours - Deprecate npm deprecate context-engine@version "Published by mistake" ``` #### **If Name is Taken:** - Use alternative name: `context-engine-mcp` - Or contact npm support --- ## **๐Ÿ“‹ Automated Workflow Script** Create a script to automate the pre-publish checks: ```bash #!/bin/bash # scripts/pre-publish.sh echo "๐Ÿ” Running pre-publish checks..." # Check if we're on master branch if [[ $(git branch --show-current) != "master" ]]; then echo "โŒ Must be on master branch to publish" exit 1 fi # Check if working directory is clean if [[ -n $(git status --porcelain) ]]; then echo "โŒ Working directory not clean. Commit or stash changes." exit 1 fi # Run all checks echo "๐Ÿงช Running tests..." npm run test:run || exit 1 echo "๐Ÿ”จ Building project..." npm run build || exit 1 echo "๐Ÿ” Running linting..." npm run lint || exit 1 echo "๐Ÿ“ Type checking..." npm run type-check || exit 1 echo "๐Ÿ›ก๏ธ Security audit..." npm audit || exit 1 echo "๐Ÿ“ฆ Dry run packaging..." npm pack --dry-run || exit 1 echo "โœ… All checks passed! Ready to publish." echo "Run: npm publish" ``` --- ## **๐ŸŽฏ Branch Protection Rules** Set up GitHub branch protection for `master`: - **Require pull request reviews** - **Require status checks to pass** - **Require branches to be up to date** - **Restrict pushes to master** - **Require linear history** --- ## **๐Ÿ“ Commit Message Convention** Use conventional commits: ``` feat: add new feature fix: fix bug docs: update documentation style: formatting changes refactor: code refactoring test: add tests chore: maintenance tasks ``` --- ## **๐Ÿš€ Quick Reference** ### **For Bug Fixes:** ```bash git checkout -b fix/bug-description # make changes npm run test:run git commit -m "fix: description" git push origin fix/bug-description # create PR, review, merge npm version patch npm publish ``` ### **For New Features:** ```bash git checkout -b feat/feature-name # make changes npm run test:run git commit -m "feat: description" git push origin feat/feature-name # create PR, review, merge npm version minor npm publish ``` --- ## **โœ… Success Criteria** A successful publish means: - โœ… **All automated tests pass** - โœ… **Code review completed** - โœ… **Documentation updated** - โœ… **Version properly incremented** - โœ… **Package installs correctly** - โœ… **Executable works as expected** - โœ… **No sensitive data exposed** **Follow this workflow to ensure safe, reliable npm publishing!**

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/livelifelively/context-engine-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server