Skip to main content
Glama
publish.yml11 kB
name: Publish on: workflow_dispatch: defaults: run: working-directory: . permissions: contents: read jobs: setup: name: Setup runs-on: ubuntu-latest outputs: release_version: ${{ steps.retrieve-release-version.outputs.version }} permissions: contents: read steps: - name: Get release version id: retrieve-release-version run: | VERSION=$(curl "https://api.github.com/repos/withinfocus/tba-mcp-server/releases" | jq -r '.[] | select(.tag_name | contains("v")) | .tag_name' | head -1 | sed 's/^v//') echo "Latest released version: $VERSION" echo "version=$VERSION" >> "$GITHUB_OUTPUT" publish-ghpr: name: GHPR runs-on: ubuntu-latest needs: - setup permissions: contents: read deployments: write packages: write env: _PKG_VERSION: ${{ needs.setup.outputs.release_version }} steps: - name: Check out repository uses: actions/checkout@v6 with: ref: refs/tags/v${{ env._PKG_VERSION }} - name: Create deployment uses: chrnorm/deployment-action@v2 id: deployment with: token: "${{ secrets.GITHUB_TOKEN }}" initial-status: "in_progress" environment: "GHPR" description: "Deployment ${{ needs.setup.outputs.release_version }} from branch ${{ github.ref_name }}" task: release - name: Get Node version id: retrieve-node-version run: | NODE_NVMRC=$(cat .nvmrc) NODE_VERSION=${NODE_NVMRC/v/''} echo "node_version=$NODE_VERSION" >> "$GITHUB_OUTPUT" - name: Set up Node.js uses: actions/setup-node@v6 with: cache: "npm" cache-dependency-path: "**/package-lock.json" node-version: ${{ steps.retrieve-node-version.outputs.node_version }} - name: Install NPM and Husky run: npm install -g npm@latest husky - name: Download release artifact run: | wget "https://github.com/${{ github.repository }}/releases/download/v${{ env._PKG_VERSION }}/mcp-server-${{ env._PKG_VERSION }}.zip" unzip "mcp-server-${{ env._PKG_VERSION }}.zip" - name: Configure NPM registry run: | echo 'registry="https://npm.pkg.github.com/"' > ./.npmrc echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> ./.npmrc env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish to GitHub Package Registry run: | if npm publish --access public --registry=https://npm.pkg.github.com/ --userconfig=./.npmrc 2>&1 | tee publish.log; then echo "✓ Successfully published to GitHub Package Registry" elif grep -q "cannot publish over the previously published versions" publish.log || grep -q "You cannot publish over the previously published versions" publish.log || grep -q "version already exists" publish.log; then echo "ℹ️ Package version already exists in GitHub Package Registry - skipping" exit 0 else echo "✗ Failed to publish to GitHub Package Registry" exit 1 fi - name: Update deployment status (success) if: ${{ success() }} uses: chrnorm/deployment-status@v2 with: token: "${{ secrets.GITHUB_TOKEN }}" state: "success" deployment-id: ${{ steps.deployment.outputs.deployment_id }} - name: Update deployment status (failure) if: ${{ failure() }} uses: chrnorm/deployment-status@v2 with: token: "${{ secrets.GITHUB_TOKEN }}" state: "failure" deployment-id: ${{ steps.deployment.outputs.deployment_id }} publish-npm: name: NPM runs-on: ubuntu-latest needs: - setup permissions: contents: read deployments: write id-token: write packages: read env: _PKG_VERSION: ${{ needs.setup.outputs.release_version }} steps: - name: Check out repository uses: actions/checkout@v6 with: ref: refs/tags/v${{ env._PKG_VERSION }} - name: Create deployment uses: chrnorm/deployment-action@v2 id: deployment with: token: "${{ secrets.GITHUB_TOKEN }}" initial-status: "in_progress" environment: "NPM" description: "Deployment ${{ needs.setup.outputs.release_version }} from branch ${{ github.ref_name }}" task: release - name: Get Node version id: retrieve-node-version run: | NODE_NVMRC=$(cat .nvmrc) NODE_VERSION=${NODE_NVMRC/v/''} echo "node_version=$NODE_VERSION" >> "$GITHUB_OUTPUT" - name: Set up Node.js uses: actions/setup-node@v6 with: cache: "npm" cache-dependency-path: "**/package-lock.json" node-version: ${{ steps.retrieve-node-version.outputs.node_version }} - name: Install NPM and Husky run: npm install -g npm@latest husky - name: Download release artifact run: | wget https://github.com/${{ github.repository }}/releases/download/v${{ env._PKG_VERSION }}/mcp-server-${{ env._PKG_VERSION }}.zip unzip mcp-server-${{ env._PKG_VERSION }}.zip - name: Publish to NPM run: | if npm publish --access public 2>&1 | tee publish.log; then echo "✓ Successfully published to NPM" elif grep -q "cannot publish over the previously published versions" publish.log || grep -q "You cannot publish over the previously published versions" publish.log || grep -q "version already exists" publish.log; then echo "ℹ️ Package version already exists on NPM - skipping" exit 0 else echo "✗ Failed to publish to NPM" exit 1 fi - name: Update deployment status (success) if: ${{ success() }} uses: chrnorm/deployment-status@v2 with: token: "${{ secrets.GITHUB_TOKEN }}" state: "success" deployment-id: ${{ steps.deployment.outputs.deployment_id }} - name: Update deployment status (failure) if: ${{ failure() }} uses: chrnorm/deployment-status@v2 with: token: "${{ secrets.GITHUB_TOKEN }}" state: "failure" deployment-id: ${{ steps.deployment.outputs.deployment_id }} publish-ghcr: name: GHCR runs-on: ubuntu-latest needs: - setup permissions: contents: read deployments: write packages: write env: _RELEASE_TAG: ${{ needs.setup.outputs.release_version }} _IMAGE_NAME: ghcr.io/withinfocus/tba-mcp-server steps: - name: Create deployment uses: chrnorm/deployment-action@v2 id: deployment with: token: "${{ secrets.GITHUB_TOKEN }}" initial-status: "in_progress" environment: "GHCR" description: "Deployment ${{ needs.setup.outputs.release_version }} from branch ${{ github.ref_name }}" task: release - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Tag and push Docker image run: | docker pull "${{ env._IMAGE_NAME }}:${{ env._RELEASE_TAG }}" docker tag "${{ env._IMAGE_NAME }}:${{ env._RELEASE_TAG }}" "${{ env._IMAGE_NAME }}:latest" if docker push "${{ env._IMAGE_NAME }}:latest" 2>&1 | tee push.log; then echo "✓ Successfully pushed Docker image to GHCR" elif grep -q "already exists" push.log || grep -q "already pushed" push.log; then echo "ℹ️ Docker image already exists in GHCR - skipping" exit 0 else echo "✗ Failed to push Docker image to GHCR" exit 1 fi - name: Update deployment status (success) if: ${{ success() }} uses: chrnorm/deployment-status@v2 with: token: "${{ secrets.GITHUB_TOKEN }}" state: "success" deployment-id: ${{ steps.deployment.outputs.deployment_id }} - name: Update deployment status (failure) if: ${{ failure() }} uses: chrnorm/deployment-status@v2 with: token: "${{ secrets.GITHUB_TOKEN }}" state: "failure" deployment-id: ${{ steps.deployment.outputs.deployment_id }} - name: Log out from GitHub Container Registry run: docker logout ghcr.io publish-mcp-registry: name: MCP Registry runs-on: ubuntu-latest needs: - setup - publish-npm if: ${{ success() }} permissions: contents: read deployments: write id-token: write env: _PKG_VERSION: ${{ needs.setup.outputs.release_version }} steps: - name: Check out repository uses: actions/checkout@v6 with: ref: refs/tags/v${{ env._PKG_VERSION }} - name: Create deployment uses: chrnorm/deployment-action@v2 id: deployment with: token: "${{ secrets.GITHUB_TOKEN }}" initial-status: "in_progress" environment: "MCP Registry" description: "Deployment ${{ needs.setup.outputs.release_version }} from branch ${{ github.ref_name }}" task: release - name: Download MCP publisher run: | curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" -o mcp-publisher.tar.gz tar -xzf mcp-publisher.tar.gz chmod +x mcp-publisher ./mcp-publisher --version - name: Authenticate with MCP registry run: ./mcp-publisher login github-oidc - name: Publish to MCP registry run: | if ./mcp-publisher publish 2>&1 | tee publish.log; then echo "✓ Successfully published to MCP registry" elif grep -q "already exists" publish.log || grep -q "already published" publish.log || grep -q "duplicate" publish.log; then echo "ℹ️ Server already exists in MCP registry - skipping" exit 0 else echo "✗ Failed to publish to MCP registry" exit 1 fi - name: Update deployment status (success) if: ${{ success() }} uses: chrnorm/deployment-status@v2 with: token: "${{ secrets.GITHUB_TOKEN }}" state: "success" deployment-id: ${{ steps.deployment.outputs.deployment_id }} - name: Update deployment status (failure) if: ${{ failure() }} uses: chrnorm/deployment-status@v2 with: token: "${{ secrets.GITHUB_TOKEN }}" state: "failure" deployment-id: ${{ steps.deployment.outputs.deployment_id }}

Latest Blog Posts

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/withinfocus/tba'

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