ssh-mcp 0.1.3

SSH Model Context Protocol Server Integration
Documentation
name: CI/CD Pipeline

on:
  push:
    branches: [ master ]
    tags:
      - 'v*'
  pull_request:
    branches: [ master ]

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
          components: rustfmt, clippy
      
      - name: Cache dependencies
        uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      
      - name: Format check
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check
      
      - name: Clippy
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: -- -D warnings
      
      - name: Run tests
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all-features

  publish:
    name: Publish to crates.io
    needs: test
    if: startsWith(github.ref, 'refs/tags/v')
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
      
      - name: Extract version
        id: extract_version
        run: |
          VERSION=${GITHUB_REF#refs/tags/v}
          echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
          CARGO_VERSION=$(grep "^version" Cargo.toml | head -n 1 | cut -d '"' -f 2)
          if [ "$VERSION" != "$CARGO_VERSION" ]; then
            echo "Error: Git tag v$CARGO_VERSION doesn't match Cargo.toml version $VERSION"
            exit 1
          fi
      
      - name: Publish
        uses: actions-rs/cargo@v1
        with:
          command: publish
          args: --token ${{ secrets.CARGO_REGISTRY_TOKEN }}