Skip to main content
Glama
publish.yml2.52 kB
name: Publish to npm on: push: branches: - main jobs: publish: runs-on: ubuntu-latest permissions: contents: write id-token: write steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: "20" registry-url: "https://registry.npmjs.org" - name: Get package info id: package run: | echo "name=$(jq -r .name package.json)" >> $GITHUB_OUTPUT echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT - name: Check version bump run: | CURRENT_VERSION=${{ steps.package.outputs.version }} PREVIOUS_VERSION=$(git show HEAD~1:package.json 2>/dev/null | jq -r '.version' || echo "0.0.0") if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ] && [ "$(printf '%s\n' "$PREVIOUS_VERSION" "$CURRENT_VERSION" | sort -V | head -n1)" = "$PREVIOUS_VERSION" ]; then echo "version_bumped=true" >> $GITHUB_ENV else echo "version_bumped=false" >> $GITHUB_ENV fi - name: Check if version exists on npm id: check run: | if npm view ${{ steps.package.outputs.name }}@${{ steps.package.outputs.version }} version 2>/dev/null; then echo "exists=true" >> $GITHUB_OUTPUT else echo "exists=false" >> $GITHUB_OUTPUT fi - name: Install dependencies if: steps.check.outputs.exists == 'false' && env.version_bumped == 'true' run: npm ci - name: Build if: steps.check.outputs.exists == 'false' && env.version_bumped == 'true' run: npm run build - name: Publish to npm if: steps.check.outputs.exists == 'false' && env.version_bumped == 'true' run: npm publish --provenance --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Create tag if: steps.check.outputs.exists == 'false' && env.version_bumped == 'true' run: git tag v${{ steps.package.outputs.version }} - name: Push tag if: steps.check.outputs.exists == 'false' && env.version_bumped == 'true' run: git push origin --tags - name: Skip publish if: steps.check.outputs.exists == 'true' || env.version_bumped == 'false' run: echo "Version ${{ steps.package.outputs.version }} already exists on npm or no version bump detected. Skipping publish."

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/yogeshhrathod/JiraMCP'

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