feat: implement complete MCP Resources System (addresses #29) (#32) #9
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
| # Automated Release Workflow - Stage 1: Version PR Creation | |
| # Triggers on pushes to main branch to create version bump PR | |
| name: Automated Release | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - 'docs/**' | |
| - '**.md' | |
| - '.github/workflows/issue-management.yml' | |
| - '.github/workflows/stale-issues.yml' | |
| - '.github/workflows/pr-issue-linking.yml' | |
| # Allow manual triggering for emergency releases | |
| workflow_dispatch: | |
| inputs: | |
| force_type: | |
| description: 'Force version bump type (major, minor, patch)' | |
| required: false | |
| type: choice | |
| options: | |
| - '' | |
| - major | |
| - minor | |
| - patch | |
| dry_run: | |
| description: 'Dry run (no actual release)' | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write # for creating version changes and tags | |
| pull-requests: write # for creating version bump PRs | |
| issues: read # for linking issues in PR body | |
| actions: read # for workflow access | |
| env: | |
| NODE_ENV: production | |
| jobs: | |
| create-version-pr: | |
| name: Create Version Bump PR | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| # Skip release if commit message contains [skip release] | |
| if: "!contains(github.event.head_commit.message, '[skip release]')" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Full history needed for commit analysis | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci --production=false | |
| - name: Generate version files | |
| run: npm run prebuild | |
| - name: Run comprehensive CI | |
| run: npm run ci:full | |
| env: | |
| NODE_ENV: test | |
| - name: Configure git | |
| run: | | |
| git config --local user.name "GitHub Actions" | |
| git config --local user.email "action@github.com" | |
| - name: Analyze and bump version | |
| id: version | |
| run: | | |
| echo "Analyzing commits for version bump..." | |
| # Prepare force type argument (uses beta versioning logic by default) | |
| FORCE_ARG="" | |
| # Check for manual workflow dispatch override | |
| if [ -n "${{ github.event.inputs.force_type }}" ]; then | |
| FORCE_ARG="--force-type=${{ github.event.inputs.force_type }}" | |
| echo "Manual override: ${{ github.event.inputs.force_type }}" | |
| fi | |
| # Check commit message for version override tags | |
| COMMIT_MSG=$(git log -1 --pretty=%B) | |
| if echo "$COMMIT_MSG" | grep -q '\[force-patch\]'; then | |
| FORCE_ARG="--force-type=patch" | |
| echo "Commit message override: patch" | |
| elif echo "$COMMIT_MSG" | grep -q '\[force-minor\]'; then | |
| FORCE_ARG="--force-type=minor" | |
| echo "Commit message override: minor" | |
| elif echo "$COMMIT_MSG" | grep -q '\[force-major\]'; then | |
| FORCE_ARG="--force-type=major" | |
| echo "Commit message override: major" | |
| fi | |
| # Prepare dry run argument | |
| DRY_RUN_ARG="" | |
| if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then | |
| DRY_RUN_ARG="--dry-run" | |
| echo "dry_run=true" >> $GITHUB_OUTPUT | |
| fi | |
| # Get current version before bump | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| # Run version bump script (without committing - we'll commit in PR) | |
| if ! node scripts/bump-version.cjs $FORCE_ARG $DRY_RUN_ARG --no-commit --no-tag; then | |
| echo "No version bump needed" | |
| echo "should_release=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| # Get new version after bump | |
| if [ "${{ github.event.inputs.dry_run }}" != "true" ]; then | |
| NEW_VERSION=$(node -p "require('./package.json').version") | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| echo "should_release=true" >> $GITHUB_OUTPUT | |
| echo "tag_name=v$NEW_VERSION" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build for release | |
| if: steps.version.outputs.should_release == 'true' | |
| run: | | |
| npm run clean | |
| npm run build | |
| - name: Run final tests | |
| if: steps.version.outputs.should_release == 'true' | |
| run: npm run test:all | |
| env: | |
| NODE_ENV: test | |
| - name: Create version bump PR | |
| if: steps.version.outputs.should_release == 'true' | |
| run: | | |
| # Check if there are any changes to commit | |
| if ! git diff --quiet || ! git diff --staged --quiet; then | |
| echo "Creating version bump PR..." | |
| # Create a new branch for version changes | |
| BRANCH_NAME="release/v${{ steps.version.outputs.new_version }}" | |
| git checkout -b "$BRANCH_NAME" | |
| # Add and commit version changes (generated files will be created during build) | |
| git add package.json CHANGELOG.md | |
| git commit -m "chore: release v${{ steps.version.outputs.new_version }} [skip release] | |
| - Automated version bump from ${{ steps.version.outputs.current_version }} to ${{ steps.version.outputs.new_version }} | |
| - Updated CHANGELOG.md with release notes | |
| - Version.ts will be auto-generated during build process | |
| Closes issues referenced in commits since v${{ steps.version.outputs.current_version }} | |
| 🤖 Generated by automated release workflow" | |
| # Create git tag for the release (will be pushed with the branch) | |
| git tag -a "v${{ steps.version.outputs.new_version }}" -m "Release ${{ steps.version.outputs.new_version }} | |
| - Automated release from version bump PR | |
| - NPM package: @jerfowler/agent-comm-mcp-server@${{ steps.version.outputs.new_version }} | |
| 🤖 Generated by automated release workflow" | |
| # Push the branch and tag | |
| git push origin "$BRANCH_NAME" | |
| git push origin "v${{ steps.version.outputs.new_version }}" | |
| # Create PR using GitHub CLI | |
| gh pr create \ | |
| --title "chore: release v${{ steps.version.outputs.new_version }}" \ | |
| --body "## 🚀 Automated Version Release | |
| This PR contains the automated version bump from **v${{ steps.version.outputs.current_version }}** to **v${{ steps.version.outputs.new_version }}**. | |
| ### 📦 Changes Included | |
| - \`package.json\`: Updated version to ${{ steps.version.outputs.new_version }} | |
| - \`CHANGELOG.md\`: Generated changelog entries for new version | |
| - Git tag \`v${{ steps.version.outputs.new_version }}\` created and pushed | |
| - Generated files (\`version.ts\`) will be created during CI build | |
| ### 🔄 Next Steps After Merge | |
| 1. **NPM Publication**: Automated publish to [@jerfowler/agent-comm-mcp-server](https://www.npmjs.com/package/@jerfowler/agent-comm-mcp-server) | |
| 2. **GitHub Release**: Automated release creation with changelog notes | |
| 3. **Git Tagging**: Tag already created and pushed | |
| ### 📋 Validation Completed | |
| - ✅ Full CI pipeline passed | |
| - ✅ Version bump analysis completed | |
| - ✅ Build verification successful | |
| - ✅ Final tests passed | |
| --- | |
| **Type**: ${{ contains(github.event.head_commit.message, '[force-patch]') && 'Force Patch' || contains(github.event.head_commit.message, '[force-minor]') && 'Force Minor' || contains(github.event.head_commit.message, '[force-major]') && 'Force Major' || 'Automatic' }} • **Branch**: $BRANCH_NAME | |
| 🤖 Generated by [Automated Release workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" \ | |
| --label "release,automated" \ | |
| --base main \ | |
| --head "$BRANCH_NAME" | |
| echo "✅ Version bump PR created successfully" | |
| echo "Branch: $BRANCH_NAME" | |
| echo "Ready for review and merge to trigger publication" | |
| else | |
| echo "No version changes detected - skipping PR creation" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Summary | |
| if: steps.version.outputs.should_release == 'true' | |
| run: | | |
| echo "🎉 Version bump PR workflow completed!" | |
| echo "✅ Version: v${{ steps.version.outputs.new_version }}" | |
| echo "✅ Branch: release/v${{ steps.version.outputs.new_version }}" | |
| echo "📋 Next: Review and merge PR to trigger publication" | |
| - name: Dry run summary | |
| if: steps.version.outputs.dry_run == 'true' | |
| run: | | |
| echo "🧪 DRY RUN COMPLETED" | |
| echo "No changes were made to repository or packages" | |
| echo "Version would have been bumped from ${{ steps.version.outputs.current_version }}" | |
| # Notify of version PR creation status | |
| notify: | |
| name: Notify PR Creation Status | |
| runs-on: ubuntu-latest | |
| needs: create-version-pr | |
| if: always() | |
| steps: | |
| - name: PR Creation Success | |
| if: needs.create-version-pr.result == 'success' | |
| run: | | |
| echo "🎉 Version bump PR creation completed successfully" | |
| echo "📋 Next step: Review and merge the PR to trigger publication" | |
| - name: PR Creation Failure | |
| if: needs.create-version-pr.result == 'failure' | |
| run: | | |
| echo "❌ Version bump PR creation failed" | |
| echo "Check the logs above for details" | |
| exit 1 |