intermcp 0.2.0

Ultra-fast, safe Model Context Protocol (MCP) engine and multiplexing hub in pure Rust, built for Interlayer Blockchain and open for all
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  build-release:
    name: Build Binary (${{ matrix.target }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            artifact_name: intermcp
            asset_name: intermcp-linux-x86_64.tar.gz
          - os: macos-latest
            target: aarch64-apple-darwin
            artifact_name: intermcp
            asset_name: intermcp-darwin-aarch64.tar.gz
          - os: macos-latest
            target: x86_64-apple-darwin
            artifact_name: intermcp
            asset_name: intermcp-darwin-x86_64.tar.gz
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            artifact_name: intermcp.exe
            asset_name: intermcp-windows-x86_64.zip

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Build Binary
        run: cargo build --release --target ${{ matrix.target }}

      - name: Package (Unix)
        if: runner.os != 'Windows'
        run: |
          cd target/${{ matrix.target }}/release
          tar -czf ../../../${{ matrix.asset_name }} ${{ matrix.artifact_name }}
          cd ../../..

      - name: Package (Windows)
        if: runner.os == 'Windows'
        run: |
          Compress-Archive -Path target/${{ matrix.target }}/release/${{ matrix.artifact_name }} -DestinationPath ${{ matrix.asset_name }}

      - name: Upload Artifact
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.asset_name }}
          path: ${{ matrix.asset_name }}

  publish-github-release:
    name: Publish GitHub Release
    needs: build-release
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4

      - name: Download all artifacts
        uses: actions/download-artifact@v4
        with:
          path: release-assets
          merge-multiple: true

      - name: Create Release
        uses: softprops/action-gh-release@v2
        with:
          files: release-assets/*
          generate_release_notes: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  publish-npm:
    name: Publish to npm
    needs: publish-github-release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          registry-url: 'https://registry.npmjs.org'
      - name: Publish NPM package
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: |
          if [ -n "$NODE_AUTH_TOKEN" ]; then
            npm publish --access public
          else
            echo "NODE_AUTH_TOKEN not set, skipping npm publish"
          fi

  publish-pypi:
    name: Publish to PyPI
    needs: publish-github-release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - name: Build and Publish PyPI package
        env:
          TWINE_USERNAME: __token__
          TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
        run: |
          if [ -n "$TWINE_PASSWORD" ]; then
            cd python
            pip install --upgrade build twine
            python -m build
            twine upload dist/* --non-interactive
          else
            echo "TWINE_PASSWORD not set, skipping PyPI publish"
          fi

  publish-crates-io:
    name: Publish to Crates.io
    needs: publish-github-release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Publish to crates.io
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          if [ -n "$CARGO_REGISTRY_TOKEN" ]; then
            cargo publish
          else
            echo "CARGO_REGISTRY_TOKEN not set, skipping crates.io publish"
          fi