Skip to main content
Glama
release.yml8.25 kB
name: Release on: push: tags: - "v*" workflow_dispatch: permissions: contents: write id-token: write env: CARGO_TERM_COLOR: always jobs: build: name: Build ${{ matrix.archive }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - target: x86_64-unknown-linux-gnu os: ubuntu-22.04 archive: docdexd-linux-x64-gnu - target: x86_64-unknown-linux-musl os: ubuntu-22.04 archive: docdexd-linux-x64-musl cross_deps: "musl-tools" linker: "musl-gcc" - target: aarch64-unknown-linux-gnu os: ubuntu-22.04 archive: docdexd-linux-arm64-gnu cross_deps: "gcc-aarch64-linux-gnu" linker: "aarch64-linux-gnu-gcc" ar: "aarch64-linux-gnu-ar" cc: "aarch64-linux-gnu-gcc" - target: x86_64-apple-darwin os: macos-15 archive: docdexd-darwin-x64 - target: aarch64-apple-darwin os: macos-latest archive: docdexd-darwin-arm64 - target: x86_64-pc-windows-msvc os: windows-latest archive: docdexd-win32-x64 steps: - name: Checkout uses: actions/checkout@v4 - name: Compute source date epoch id: epoch run: echo "epoch=$(git log -1 --format=%ct)" >> "$GITHUB_OUTPUT" - name: Install Rust uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Cache cargo uses: Swatinem/rust-cache@v2 with: key: ${{ runner.os }}-${{ matrix.target }} workspaces: | . - name: Tests run: cargo test --locked --all - name: Install cross toolchain if: ${{ matrix.cross_deps != '' }} run: sudo apt-get update && sudo apt-get install -y ${{ matrix.cross_deps }} - name: Build release binary env: SOURCE_DATE_EPOCH: ${{ steps.epoch.outputs.epoch }} CARGO_PROFILE_RELEASE_DEBUG: 0 CARGO_PROFILE_RELEASE_LTO: true CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1 RUSTFLAGS: "-C strip=symbols" CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: ${{ matrix.linker }} AR_aarch64_unknown_linux_gnu: ${{ matrix.ar }} CC_aarch64_unknown_linux_gnu: ${{ matrix.cc }} CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: ${{ matrix.linker }} run: cargo build --release --locked --target ${{ matrix.target }} - name: Package binary shell: bash run: | mkdir -p dist BIN_NAME="docdexd" if [[ "${{ matrix.target }}" == *"windows"* ]]; then BIN_NAME="docdexd.exe" fi cp "target/${{ matrix.target }}/release/${BIN_NAME}" "dist/${BIN_NAME}" tar -czf ${{ matrix.archive }}.tar.gz -C dist "${BIN_NAME}" python -c "import hashlib, pathlib; p=pathlib.Path('${{ matrix.archive }}.tar.gz'); h=hashlib.sha256(p.read_bytes()).hexdigest(); pathlib.Path(f'{p}.sha256').write_text(f'{h} {p.name}\n')" - name: Upload GitHub release assets uses: softprops/action-gh-release@v1 with: tag_name: ${{ github.ref_name }} files: | ${{ matrix.archive }}.tar.gz ${{ matrix.archive }}.sha256 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload artifacts for npm packaging uses: actions/upload-artifact@v4 with: name: ${{ matrix.archive }} path: | ${{ matrix.archive }}.tar.gz ${{ matrix.archive }}.sha256 publish-npm: name: Publish npm package and MCP server needs: build runs-on: ubuntu-latest environment: release steps: - name: Checkout uses: actions/checkout@v4 - name: Download build artifacts uses: actions/download-artifact@v4 with: pattern: docdexd-* path: artifacts merge-multiple: true - name: List artifacts run: ls -lh artifacts - name: Verify artifact checksums shell: bash working-directory: artifacts run: | set -euo pipefail shopt -s nullglob for f in *.sha256; do shasum -a 256 -c "$f" done - name: Verify tag matches crate and npm versions run: | TAG="${GITHUB_REF_NAME#v}" CRATE_VERSION=$(python -c "import tomllib, pathlib; print(tomllib.loads(pathlib.Path('Cargo.toml').read_text())['package']['version'])") PKG_VERSION=$(node -p "require('./npm/package.json').version") if [ "$TAG" != "$CRATE_VERSION" ]; then echo "Tag v$TAG does not match Cargo.toml version $CRATE_VERSION" exit 1 fi if [ "$TAG" != "$PKG_VERSION" ]; then echo "Tag v$TAG does not match npm/package.json version $PKG_VERSION" exit 1 fi echo "✓ Tag matches Cargo.toml and npm/package.json: $TAG" # Keep server.json in sync with npm/package.json before publishing - name: Update server.json version run: | node -e " const fs = require('fs'); const pkg = JSON.parse(fs.readFileSync('npm/package.json', 'utf8')); const server = JSON.parse(fs.readFileSync('server.json', 'utf8')); const version = pkg.version; server.version = version; if (Array.isArray(server.packages) && server.packages.length > 0) { server.packages[0].version = version; } fs.writeFileSync('server.json', JSON.stringify(server, null, 2) + '\n'); " - name: Verify server.json version run: | PKG_VERSION=$(node -p "require('./npm/package.json').version") SERVER_VERSION=$(node -e "console.log(require('./server.json').version)") if [ "$PKG_VERSION" != "$SERVER_VERSION" ]; then echo "Error: Version mismatch between npm/package.json ($PKG_VERSION) and server.json ($SERVER_VERSION)" exit 1 fi echo "✓ server.json version synchronized: $SERVER_VERSION" - name: Setup Node uses: actions/setup-node@v4 with: node-version: 20 registry-url: https://registry.npmjs.org - name: Update npm to latest (trusted publish requires >=11.5.1) run: npm install -g npm@latest - name: Cache node modules uses: actions/cache@v4 with: path: | ~/.npm key: node-${{ runner.os }}-${{ hashFiles('npm/package-lock.json') }} restore-keys: | node-${{ runner.os }}- - name: Install npm deps (no postinstall) working-directory: npm run: npm install --ignore-scripts - name: Pack npm tarball (verification) working-directory: npm run: npm pack --ignore-scripts - name: Publish to npm working-directory: npm env: DOCDEX_DOWNLOAD_REPO: ${{ github.repository }} NPM_CONFIG_PROVENANCE: "true" run: npm publish --access public --provenance - name: Smoke test install from packed tarball shell: bash env: DOCDEX_DOWNLOAD_REPO: ${{ github.repository }} DOCDEX_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -euo pipefail PACK_TGZ=$(ls npm/docdex-*.tgz | head -n 1) PACK_PATH="$PWD/$PACK_TGZ" TEST_DIR=$(mktemp -d) pushd "$TEST_DIR" >/dev/null npm init -y >/dev/null npm install "$PACK_PATH" npx docdex --version popd >/dev/null # MCP Registry publishing - name: Install MCP Publisher run: | curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.3.10/mcp-publisher_linux_amd64.tar.gz" \ | tar xz mcp-publisher chmod +x mcp-publisher - name: Login to MCP Registry run: ./mcp-publisher login github-oidc - name: Publish to MCP Registry run: ./mcp-publisher publish

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/bekirdag/docdex'

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