dory-memory 0.1.8

Backend memory store for Hermes Agent — pgvector-powered semantic memory engine with server-side embeddings
name: Release

on:
  push:
    tags:
      - "v*"
  workflow_dispatch:

permissions:
  contents: write
  packages: write

jobs:
  build:
    name: ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
            ext: ""
            archive: tar.gz
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-24.04-arm
            ext: ""
            archive: tar.gz
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust toolchain
        run: rustup target add ${{ matrix.target }}
      - name: Build
        run: cargo build --release --target ${{ matrix.target }}
      - name: Prepare archive
        shell: bash
        run: |
          BIN="target/${{ matrix.target }}/release/dory-memory${{ matrix.ext }}"
          ARCHIVE_NAME="dory-memory${{ matrix.ext }}"
          cp "$BIN" "$ARCHIVE_NAME"
          PKG="dory-memory-${{ matrix.target }}"
          if [ "${{ matrix.archive }}" = "tar.gz" ]; then
            tar czf "$PKG.tar.gz" "$ARCHIVE_NAME"
            echo "ARTIFACT=$PKG.tar.gz" >> $GITHUB_ENV
          else
            7z a "$PKG.zip" "$ARCHIVE_NAME"
            echo "ARTIFACT=$PKG.zip" >> $GITHUB_ENV
          fi
      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: dory-memory-${{ matrix.target }}
          path: ${{ env.ARTIFACT }}

  release:
    needs: [build]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v4
        with:
          pattern: dory-memory-*
          merge-multiple: true
      - name: Generate release body
        run: |
          cat > notes.md <<'EOF'
          ## dory-memory

          ### Downloads

          | Architecture | File |
          |---|---|
          EOF
          for f in *.*; do
            [[ "$f" == *.md ]] && continue
            [[ "$f" == *.txt ]] && continue
            [ -f "$f" ] || continue
            arch=$(echo "$f" | sed 's/^dory-memory-//; s/\.tar\.gz$//; s/\.zip$//')
            echo "| \`$arch\` | \`$f\` |" >> notes.md
          done
      - name: Create release
        uses: softprops/action-gh-release@v2
        with:
          name: dory-memory ${{ github.ref_name }}
          body_path: notes.md
          files: |
            *.tar.gz
            *.zip
          generate_release_notes: true

  publish:
    needs: [build]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Publish to crates.io
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish --allow-dirty

  docker:
    needs: [build]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Log in to GitHub Container Registry
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Extract version from tag
        id: meta
        run: |
          VERSION=${GITHUB_REF_NAME#v}
          echo "version=$VERSION" >> "$GITHUB_OUTPUT"
      - name: Build and push Docker image
        uses: docker/build-push-action@v6
        with:
          context: .
          push: true
          tags: |
            ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.version }}
            ghcr.io/${{ github.repository }}:latest