name: Automated Publishing Pipeline
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
dry_run:
description: "Run in dry-run mode (skip actual publishing)"
required: false
default: false
type: boolean
permissions:
contents: write
id-token: write
env:
NODE_VERSION: "20"
REGISTRY_TIMEOUT: "300"
jobs:
validate:
name: Validate Release Prerequisites
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.version }}
should_publish: ${{ steps.validate-secrets.outputs.should_publish }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Extract version from tag
id: extract-version
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
else
echo "Not a version tag, using package.json version"
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
fi
- name: Validate version synchronization
run: npm run version:validate
- name: Build and verify NPM readiness
run: npm run verify:npm-ready
- name: Validate required secrets
id: validate-secrets
run: |
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
echo "should_publish=false" >> $GITHUB_OUTPUT
elif [[ -z "${{ secrets.NPM_TOKEN }}" ]]; then
echo "NPM_TOKEN secret is not configured"
exit 1
else
echo "should_publish=true" >> $GITHUB_OUTPUT
fi
publish:
name: Publish to Registries
runs-on: ubuntu-latest
needs: validate
if: success()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Install MCP Publisher CLI
run: |
sudo apt-get update
sudo apt-get install -y golang-go
git clone https://github.com/modelcontextprotocol/registry publisher-repo
cd publisher-repo
timeout ${{ env.REGISTRY_TIMEOUT }} make publisher
cp bin/mcp-publisher ../mcp-publisher
cd ..
chmod +x mcp-publisher
./mcp-publisher --version
- name: Authenticate with MCP Registry
run: ./mcp-publisher login github-oidc
- name: Publish to NPM Registry
if: needs.validate.outputs.should_publish == 'true'
run: |
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
npm publish --access public --dry-run
else
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Wait for NPM propagation
if: needs.validate.outputs.should_publish == 'true' && inputs.dry_run != true
run: |
PACKAGE_NAME="financial-modeling-prep-mcp-server"
VERSION="${{ needs.validate.outputs.version }}"
for i in {1..30}; do
if curl -s "https://registry.npmjs.org/$PACKAGE_NAME/$VERSION" | grep -q "\"version\":\"$VERSION\""; then
break
fi
sleep 10
done
- name: Publish to MCP Registry
run: |
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
./mcp-publisher publish --dry-run
else
./mcp-publisher publish
fi
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [validate, publish]
if: success() && inputs.dry_run != true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
name: "Release v${{ needs.validate.outputs.version }}"
body: |
## Release v${{ needs.validate.outputs.version }}
This release has been automatically published to:
- NPM Registry: `npm install financial-modeling-prep-mcp-server@${{ needs.validate.outputs.version }}`
- MCP Registry: Available at https://registry.modelcontextprotocol.io/servers/io.github.imbenrabi/financial-modeling-prep-mcp-server
### Installation Methods
**NPM:**
```bash
npm install -g financial-modeling-prep-mcp-server
```
**NPX (recommended):**
```bash
npx financial-modeling-prep-mcp-server --fmp-token=YOUR_TOKEN
```
**MCP Registry:**
Search for "financial-modeling-prep-mcp-server" in your MCP client.
notify-failure:
name: Notify on Failure
runs-on: ubuntu-latest
needs: [validate, publish, release]
if: failure()
steps:
- name: Report failure
run: |
echo "Automated publishing pipeline failed"
echo "Manual publishing commands:"
echo "1. npm run publish:validate"
echo "2. npm run publish:manual"
echo "3. npm run verify:registry-submission"
exit 1