rustic-git 0.6.0

A Rustic Git - clean type-safe API over git cli
Documentation
name: Release to crates.io
permissions:
  contents: write
  pull-requests: write

on:
    release:
        types: [published]

env:
    CARGO_TERM_COLOR: always

jobs:
    publish:
        runs-on: ubuntu-latest

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

            - name: Install Rust toolchain
              uses: actions-rust-lang/setup-rust-toolchain@v1
              with:
                  toolchain: stable
                  components: rustfmt, clippy

            - name: Cache dependencies
              uses: actions/cache@v4
              with:
                  path: |
                      ~/.cargo/registry
                      ~/.cargo/git
                      target
                  key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
                  restore-keys: |
                      ${{ runner.os }}-cargo-

            - name: Verify release tag matches Cargo.toml version
              run: |
                  # Extract version from Cargo.toml
                  CARGO_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
                  # Extract version from GitHub release tag (remove 'v' prefix if present)
                  RELEASE_VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')

                  echo "Cargo.toml version: $CARGO_VERSION"
                  echo "Release tag version: $RELEASE_VERSION"

                  if [ "$CARGO_VERSION" != "$RELEASE_VERSION" ]; then
                    echo "Version mismatch! Cargo.toml version ($CARGO_VERSION) does not match release tag ($RELEASE_VERSION)"
                    exit 1
                  fi

                  echo "Version verification passed"

            - name: Format check
              run: cargo fmt --all -- --check

            - name: Clippy check
              run: cargo clippy --all-targets --all-features -- -D warnings

            - name: Run tests
              run: cargo test --all-features

            - name: Verify examples compile and run
              run: |
                  echo "Testing examples..."
                  for example in examples/*.rs; do
                    example_name=$(basename "$example" .rs)
                    echo "Building example: $example_name"
                    cargo build --example "$example_name"
                  done

                  # Test a few key examples to make sure they work
                  echo "Running basic_usage example..."
                  timeout 30s cargo run --example basic_usage || echo "Example completed or timed out"

                  echo "Running repository_operations example..."
                  timeout 30s cargo run --example repository_operations || echo "Example completed or timed out"

            - name: Build release
              run: cargo build --release --all-features

            - name: Verify package contents
              run: |
                  cargo package --list
                  echo "Package contents verified"

            - name: Dry run publish
              run: cargo publish --dry-run --all-features

            - name: Publish to crates.io
              run: cargo publish --all-features
              env:
                  CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

            - name: Create publish summary
              run: |
                  echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
                  echo "" >> $GITHUB_STEP_SUMMARY
                  echo " **Published to crates.io**: \`rustic-git v${{ github.event.release.tag_name }}\`" >> $GITHUB_STEP_SUMMARY
                  echo "" >> $GITHUB_STEP_SUMMARY
                  echo "### Package Details" >> $GITHUB_STEP_SUMMARY
                  echo "- **Version**: ${{ github.event.release.tag_name }}" >> $GITHUB_STEP_SUMMARY
                  echo "- **Registry**: [crates.io](https://crates.io/crates/rustic-git)" >> $GITHUB_STEP_SUMMARY
                  echo "- **Documentation**: [docs.rs](https://docs.rs/rustic-git)" >> $GITHUB_STEP_SUMMARY
                  echo "" >> $GITHUB_STEP_SUMMARY
                  echo "### Quality Checks Passed" >> $GITHUB_STEP_SUMMARY
                  echo "-  Code formatting (rustfmt)" >> $GITHUB_STEP_SUMMARY
                  echo "-  Linting (clippy with zero warnings)" >> $GITHUB_STEP_SUMMARY
                  echo "-  All tests passing" >> $GITHUB_STEP_SUMMARY
                  echo "-  Examples compile and run" >> $GITHUB_STEP_SUMMARY
                  echo "-  Version verification" >> $GITHUB_STEP_SUMMARY