release.yml•6.14 kB
name: Release to npm
on:
push:
tags:
- 'v*.*.*' # Triggers on version tags like v1.0.0, v1.2.3, etc.
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Check TypeScript compilation
run: npx tsc --noEmit
- name: Verify build artifacts
run: |
test -f dist/servers/arxiv-server.js || exit 1
test -f dist/servers/semantic-scholar-server.js || exit 1
test -f dist/servers/pubmed-server.js || exit 1
echo "✅ All server files built successfully"
- name: Test server startup
run: |
timeout 5 node dist/servers/arxiv-server.js || true
timeout 5 node dist/servers/semantic-scholar-server.js || true
timeout 5 node dist/servers/pubmed-server.js || true
echo "✅ All servers start without errors"
publish-npm:
name: Publish to npm
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org/'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Extract version from tag
id: extract_version
run: |
TAG=${GITHUB_REF#refs/tags/v}
echo "version=$TAG" >> $GITHUB_OUTPUT
echo "📦 Publishing version: $TAG"
- name: Verify package.json version matches tag
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
TAG_VERSION=${{ steps.extract_version.outputs.version }}
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
echo "❌ Version mismatch: package.json ($PACKAGE_VERSION) != tag ($TAG_VERSION)"
exit 1
fi
echo "✅ Version match confirmed: $PACKAGE_VERSION"
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Verify npm publication
run: |
sleep 30
npm view researchmcp@${{ steps.extract_version.outputs.version }} version
echo "✅ Package published successfully to npm"
create-github-release:
name: Create GitHub Release
needs: publish-npm
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract version from tag
id: extract_version
run: |
TAG=${GITHUB_REF#refs/tags/v}
echo "version=$TAG" >> $GITHUB_OUTPUT
- name: Generate release notes
id: release_notes
run: |
VERSION=${{ steps.extract_version.outputs.version }}
echo "## 📦 Release v$VERSION" > release_notes.md
echo "" >> release_notes.md
echo "### Installation" >> release_notes.md
echo "" >> release_notes.md
echo "\`\`\`bash" >> release_notes.md
echo "# Using npx (recommended)" >> release_notes.md
echo "npx -y researchmcp-arxiv@$VERSION" >> release_notes.md
echo "npx -y researchmcp-semantic@$VERSION" >> release_notes.md
echo "npx -y researchmcp-pubmed@$VERSION" >> release_notes.md
echo "" >> release_notes.md
echo "# Or install globally" >> release_notes.md
echo "npm install -g researchmcp@$VERSION" >> release_notes.md
echo "\`\`\`" >> release_notes.md
echo "" >> release_notes.md
echo "### Package Info" >> release_notes.md
echo "" >> release_notes.md
echo "- **npm**: https://www.npmjs.com/package/researchmcp/v/$VERSION" >> release_notes.md
echo "- **Node.js**: 18+ required" >> release_notes.md
echo "- **MCP Protocol**: Compatible with all MCP clients" >> release_notes.md
echo "" >> release_notes.md
echo "### What's Included" >> release_notes.md
echo "" >> release_notes.md
echo "- 🔬 **arXiv Server**: Search and retrieve papers from arXiv" >> release_notes.md
echo "- 📚 **Semantic Scholar Server**: Access citation data and paper metrics" >> release_notes.md
echo "- 🏥 **PubMed Server**: Query biomedical and life sciences research" >> release_notes.md
echo "- 📝 **BibTeX Support**: Generate citations for all sources" >> release_notes.md
echo "- ⚡ **No API Keys Required**: All servers work out of the box" >> release_notes.md
echo "" >> release_notes.md
echo "### Documentation" >> release_notes.md
echo "" >> release_notes.md
echo "- [Quick Start Guide](https://github.com/${{ github.repository }}/blob/main/QUICKSTART.md)" >> release_notes.md
echo "- [API Documentation](https://github.com/${{ github.repository }}/blob/main/API_DOCUMENTATION.md)" >> release_notes.md
echo "- [Contributing Guide](https://github.com/${{ github.repository }}/blob/main/CONTRIBUTING.md)" >> release_notes.md
cat release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: Release v${{ steps.extract_version.outputs.version }}
body_path: release_notes.md
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}