origin-mcp 0.4.1

MCP server for Origin — personal agent memory layer
Documentation
name: Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: write

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    name: Build ${{ matrix.name }}
    runs-on: ${{ matrix.runner }}
    strategy:
      matrix:
        include:
          - name: darwin-arm64
            target: aarch64-apple-darwin
            runner: macos-latest
            os: macos
          - name: linux-x64
            target: x86_64-unknown-linux-gnu
            runner: ubuntu-latest
            os: linux
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust toolchain
        run: |
          rustup toolchain install stable --profile minimal
          rustup target add ${{ matrix.target }}

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

      - name: Ad-hoc sign macOS binary
        if: matrix.os == 'macos'
        run: codesign --sign - --force target/${{ matrix.target }}/release/origin-mcp

      - name: Package artifacts
        run: |
          tar czf origin-mcp-${{ matrix.name }}.tar.gz -C target/${{ matrix.target }}/release origin-mcp
          cp target/${{ matrix.target }}/release/origin-mcp origin-mcp-${{ matrix.name }}

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: origin-mcp-${{ matrix.name }}
          path: |
            origin-mcp-${{ matrix.name }}.tar.gz
            origin-mcp-${{ matrix.name }}

  release:
    name: Create GitHub Release
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Download all artifacts
        uses: actions/download-artifact@v4
        with:
          merge-multiple: true

      - name: Create release
        uses: softprops/action-gh-release@v2
        with:
          generate_release_notes: true
          files: |
            origin-mcp-darwin-arm64.tar.gz
            origin-mcp-linux-x64.tar.gz
            origin-mcp-darwin-arm64
            origin-mcp-linux-x64

  publish-crates:
    name: Publish to crates.io
    needs: release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust toolchain
        run: rustup toolchain install stable --profile minimal

      - name: Publish
        run: cargo publish || echo "Already published, skipping"
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

  update-homebrew:
    name: Update Homebrew tap
    needs: release
    runs-on: ubuntu-latest
    steps:
      - name: Download artifacts
        uses: actions/download-artifact@v4
        with:
          merge-multiple: true

      - name: Compute checksums and update formula
        env:
          HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
        run: |
          VERSION="${GITHUB_REF_NAME#v}"

          SHA_DARWIN_ARM64=$(sha256sum origin-mcp-darwin-arm64.tar.gz | cut -d' ' -f1)
          SHA_LINUX_X64=$(sha256sum origin-mcp-linux-x64.tar.gz | cut -d' ' -f1)

          git clone https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/7xuanlu/homebrew-tap.git tap
          mkdir -p tap/Formula

          # WARNING: the HEREDOC body below is indented with EXACTLY 10 spaces
          # (YAML's 8 + Ruby's 2). The `sed -i 's/^          //'` line at the
          # bottom of this step strips that exact prefix to produce the formula.
          # Do NOT run yamllint, Prettier, or any auto-formatter on this file —
          # changing the indent by even one space breaks formula generation
          # silently (brew tap will reject the malformed result on next release).
          cat > tap/Formula/origin-mcp.rb << FORMULA
          class OriginMcp < Formula
            desc "MCP server for Origin — personal agent memory layer"
            homepage "https://github.com/7xuanlu/origin-mcp"
            url "https://github.com/7xuanlu/origin-mcp/releases/download/v${VERSION}/origin-mcp-darwin-arm64.tar.gz"
            version "${VERSION}"
            sha256 "${SHA_DARWIN_ARM64}"
            license "MIT"

            livecheck do
              url :homepage
              strategy :github_latest
            end

            on_macos do
              depends_on arch: :arm64
            end

            on_linux do
              depends_on arch: :x86_64
              on_intel do
                url "https://github.com/7xuanlu/origin-mcp/releases/download/v${VERSION}/origin-mcp-linux-x64.tar.gz"
                sha256 "${SHA_LINUX_X64}"
              end
            end

            def install
              bin.install "origin-mcp"
            end

            test do
              assert_match "origin-mcp", shell_output("#{bin}/origin-mcp --help")
            end
          end
          FORMULA

          # Fix indentation (heredoc adds leading spaces from YAML nesting)
          sed -i 's/^          //' tap/Formula/origin-mcp.rb

          cd tap
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add Formula/origin-mcp.rb
          git commit -m "origin-mcp ${VERSION}"
          git push origin HEAD:main

      - name: Verify formula syntax
        run: ruby -c tap/Formula/origin-mcp.rb

  publish-npm:
    name: Publish to npm
    needs: release
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: "24"
          registry-url: "https://registry.npmjs.org"

      - name: Sync npm version from tag
        # The git tag is the source of truth; sync npm/package.json before
        # publishing so a forgotten version bump in npm/package.json does not
        # block release (skipping straight to a higher version on retry).
        # Skip cleanly if the version on the tag is already published.
        working-directory: npm
        run: |
          VERSION="${GITHUB_REF_NAME#v}"
          npm version "$VERSION" --no-git-tag-version --allow-same-version

      - name: Publish
        working-directory: npm
        run: npm publish --provenance --access public