rmcp-memex 0.3.2

RAG/memory MCP server with LanceDB vector storage
Documentation
name: Release

on:
  push:
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+'
      - 'v[0-9]+.[0-9]+.[0-9]+-*'

env:
  CARGO_TERM_COLOR: always

jobs:
  # Build binaries for multiple platforms
  build:
    name: Build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: aarch64-apple-darwin
            os: macos-latest
            artifact: rmcp-memex-aarch64-apple-darwin
          - target: x86_64-apple-darwin
            os: macos-latest
            artifact: rmcp-memex-x86_64-apple-darwin
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
            artifact: rmcp-memex-x86_64-unknown-linux-gnu
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-latest
            artifact: rmcp-memex-aarch64-unknown-linux-gnu

    steps:
      - name: Checkout
        uses: actions/checkout@v4

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

      - name: Cache cargo
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.target }}

      - name: Install protoc (Ubuntu)
        if: runner.os == 'Linux'
        run: |
          sudo apt-get update
          sudo apt-get install -y protobuf-compiler

      - name: Install protoc (macOS)
        if: runner.os == 'macOS'
        run: brew install protobuf

      - name: Install cross-compilation tools (Linux aarch64)
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
          echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV

      - name: Build release binary
        run: cargo build --bin rmcp_memex --release --target ${{ matrix.target }}

      - name: Prepare artifact (Unix)
        run: |
          mkdir -p dist
          cp target/${{ matrix.target }}/release/rmcp_memex dist/
          chmod +x dist/rmcp_memex
          cd dist && tar -czvf ../${{ matrix.artifact }}.tar.gz rmcp_memex

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.artifact }}
          path: ${{ matrix.artifact }}.tar.gz
          retention-days: 1

  # Create GitHub release with all artifacts
  release:
    name: Create Release
    needs: build
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Download all artifacts
        uses: actions/download-artifact@v4
        with:
          path: artifacts

      - name: Extract version from tag
        id: version
        run: |
          TAG="${GITHUB_REF#refs/tags/}"
          VERSION="${TAG#v}"
          echo "tag=$TAG" >> $GITHUB_OUTPUT
          echo "version=$VERSION" >> $GITHUB_OUTPUT

      - name: Generate changelog
        id: changelog
        run: |
          VERSION="${{ steps.version.outputs.version }}"

          # Get previous tag
          PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")

          if [ -z "$PREV_TAG" ]; then
            echo "No previous tag found, using all commits"
            COMMITS=$(git log --oneline --no-merges | head -20)
          else
            echo "Generating changelog from $PREV_TAG to v$VERSION"
            COMMITS=$(git log --oneline --no-merges "$PREV_TAG"..HEAD)
          fi

          # Build changelog body
          BODY="## rmcp-memex $VERSION\n\n"
          BODY+="RAG/memory MCP server with LanceDB vector storage.\n\n"
          BODY+="### Changes\n\n"

          while IFS= read -r line; do
            [ -n "$line" ] && BODY+="- ${line#* }\n"
          done <<< "$COMMITS"

          BODY+="\n### Installation\n\n"
          BODY+="\`\`\`bash\n"
          BODY+="# One-line install\n"
          BODY+="curl -sSf https://raw.githubusercontent.com/VetCoders/rmcp-memex/main/install.sh | sh\n\n"
          BODY+="# Or download binary directly\n"
          BODY+="# macOS Apple Silicon\n"
          BODY+="curl -LO https://github.com/VetCoders/rmcp-memex/releases/download/v$VERSION/rmcp-memex-aarch64-apple-darwin.tar.gz\n"
          BODY+="\`\`\`\n\n"
          BODY+="### MCP Host Configuration\n\n"
          BODY+="\`\`\`json\n"
          BODY+="{\n"
          BODY+="  \"mcpServers\": {\n"
          BODY+="    \"rmcp_memex\": {\n"
          BODY+="      \"command\": \"/path/to/rmcp_memex\",\n"
          BODY+="      \"args\": [\"serve\"]\n"
          BODY+="    }\n"
          BODY+="  }\n"
          BODY+="}\n"
          BODY+="\`\`\`\n"

          # Save to file for the release action
          echo -e "$BODY" > /tmp/release_notes.md
          cat /tmp/release_notes.md

          # Set output
          echo "body<<EOF" >> $GITHUB_OUTPUT
          cat /tmp/release_notes.md >> $GITHUB_OUTPUT
          echo "EOF" >> $GITHUB_OUTPUT

      - name: Collect artifacts
        run: |
          mkdir -p release-files
          find artifacts -name "*.tar.gz" -exec cp {} release-files/ \;
          ls -la release-files/

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v1
        with:
          tag_name: ${{ steps.version.outputs.tag }}
          name: rmcp-memex ${{ steps.version.outputs.version }}
          body: ${{ steps.changelog.outputs.body }}
          draft: false
          prerelease: ${{ contains(steps.version.outputs.tag, '-') }}
          files: release-files/*
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}