Skip to main content
Glama
publish.yaml3.02 kB
name: Publish to NPM on: workflow_dispatch: inputs: version_type: description: 'Version type (major, minor, patch)' required: true default: 'patch' type: choice options: - patch - minor - major jobs: publish: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '18' registry-url: 'https://registry.npmjs.org' - name: Configure Git run: | git config user.name "GitHub Actions Bot" git config user.email "github-actions[bot]@users.noreply.github.com" - name: Install dependencies run: npm install - name: Run tests run: npm test - name: Calculate new version id: version run: | # Get current version from package.json # Get current version from package.json CURRENT_VERSION=$(node -p "require('./package.json').version") # Get latest tag version from git LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") LATEST_TAG_VERSION=${LATEST_TAG#v} # Use the latest tag version if available, otherwise use package.json version CURRENT_VERSION=${LATEST_TAG_VERSION:-$CURRENT_VERSION} # Calculate new version based on semver if [ "${{ github.event.inputs.version_type }}" = "major" ]; then NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{print ($1+1) ".0.0"}') elif [ "${{ github.event.inputs.version_type }}" = "minor" ]; then NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{print $1 "." ($2+1) ".0"}') else NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{print $1 "." $2 "." ($3+1)}') fi echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT - name: Build project run: npm run build - name: Create Git tag run: | git tag -a "v${{ steps.version.outputs.new_version }}" -m "Release v${{ steps.version.outputs.new_version }}" git push origin "v${{ steps.version.outputs.new_version }}" - name: Create GitHub Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} uses: softprops/action-gh-release@v1 with: tag_name: "v${{ steps.version.outputs.new_version }}" name: "Release v${{ steps.version.outputs.new_version }}" draft: false prerelease: false generate_release_notes: true - name: Publish package to NPM env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} run: | # Temporarily update version for publishing npm version ${{ steps.version.outputs.new_version }} --no-git-tag-version npm publish --access public # Revert package.json changes git checkout -- package.json package-lock.json - name: Link to NPX run: npm link

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/gofireflyio/firefly-mcp'

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