ookcite-mcp 0.4.5

MCP server for OokCite citation validation and formatting
Documentation
name: Release

on:
  push:
    tags: ['v*']

permissions:
  contents: write

jobs:
  build:
    strategy:
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
            name: ookcite-mcp-x86_64-unknown-linux-gnu
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-latest
            name: ookcite-mcp-aarch64-unknown-linux-gnu
          - target: x86_64-apple-darwin
            os: macos-latest
            name: ookcite-mcp-x86_64-apple-darwin
          - target: aarch64-apple-darwin
            os: macos-latest
            name: ookcite-mcp-aarch64-apple-darwin
          - target: x86_64-pc-windows-msvc
            os: windows-latest
            name: ookcite-mcp-x86_64-pc-windows-msvc

    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v5

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

      - 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

      - name: Build
        env:
          CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
        run: cargo build --release --target ${{ matrix.target }}

      - name: Package (unix)
        if: runner.os != 'Windows'
        run: |
          # Copy keeping the original binary name, then archive the binary into a named tarball
          cp target/${{ matrix.target }}/release/ookcite-mcp ./ookcite-mcp
          chmod +x ./ookcite-mcp
          tar czf ${{ matrix.name }}.tar.gz ookcite-mcp
          sha256sum ${{ matrix.name }}.tar.gz > ${{ matrix.name }}.tar.gz.sha256

      - name: Package (windows)
        if: runner.os == 'Windows'
        run: |
          # Copy keeping the original binary name, then archive into a named zip
          cp target/${{ matrix.target }}/release/ookcite-mcp.exe .\ookcite-mcp.exe
          Compress-Archive -Path .\ookcite-mcp.exe -DestinationPath ${{ matrix.name }}.zip
          Get-FileHash ${{ matrix.name }}.zip -Algorithm SHA256 | ForEach-Object { "$($_.Hash)  ${{ matrix.name }}.zip" } | Out-File ${{ matrix.name }}.zip.sha256

      - name: Upload release assets
        uses: softprops/action-gh-release@v2
        env:
          FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
        with:
          files: |
            ${{ matrix.name }}.tar.gz
            ${{ matrix.name }}.tar.gz.sha256
            ${{ matrix.name }}.zip
            ${{ matrix.name }}.zip.sha256

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

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - name: Publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish --allow-dirty

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

      - uses: actions/setup-node@v6
        with:
          node-version: 22
          registry-url: https://registry.npmjs.org

      - name: Set version from tag and publish
        working-directory: npm
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: |
          VERSION="${GITHUB_REF_NAME#v}"
          npm version "$VERSION" --no-git-tag-version --allow-same-version
          npm publish --access public --provenance 2>&1 || {
            if npm view "@turtletech/ookcite-mcp@$VERSION" version >/dev/null 2>&1; then
              echo "Version $VERSION already published, skipping"
            else
              exit 1
            fi
          }