Skip to main content
Glama
npm-publish.yml2.35 kB
name: Publish to npm on: push: branches: - main paths: - 'package.json' jobs: check-version: runs-on: ubuntu-latest outputs: version-changed: ${{ steps.check.outputs.changed }} version: ${{ steps.check.outputs.version }} steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 2 - name: Check if version changed id: check run: | # Get current version CURRENT_VERSION=$(node -p "require('./package.json').version") echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT # Get previous version (if exists) git show HEAD~1:package.json > /tmp/old-package.json 2>/dev/null || echo '{"version":"0.0.0"}' > /tmp/old-package.json PREVIOUS_VERSION=$(node -p "require('/tmp/old-package.json').version") echo "Current version: $CURRENT_VERSION" echo "Previous version: $PREVIOUS_VERSION" if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then echo "changed=true" >> $GITHUB_OUTPUT echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION" else echo "changed=false" >> $GITHUB_OUTPUT echo "Version unchanged" fi publish: needs: check-version if: needs.check-version.outputs.version-changed == 'true' 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: Install dependencies run: npm ci - name: Build package run: npm run build - name: Publish to npm run: npm publish --provenance --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Create git tag run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git tag "v${{ needs.check-version.outputs.version }}" git push origin "v${{ needs.check-version.outputs.version }}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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/owen-lacey/fpl-mcp'

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