gitsync 0.2.1

Library that facilitates monitoring Git repositories for changes. Could enable GitOps
Documentation
# Borrowed from https://raw.githubusercontent.com/sharkdp/bat/master/.github/workflows/CICD.yml
name: release

env:
    MIN_SUPPORTED_RUST_VERSION: "1.90.0"
    CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
    #https://github.com/rust-lang/cargo/issues/10303
    CARGO_NET_GIT_FETCH_WITH_CLI: "true"

on:
    push:
        branches:
            - "main"
        tags:
            - "*"

permissions:
    contents: read

jobs:
    lint:
        runs-on: ubuntu-latest
        steps:
            - name: Git checkout
              uses: actions/checkout@v6
            - name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
              uses: moonrepo/setup-rust@v1
              with:
                  channel: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
                  components: clippy
                  bins: cargo-tarpaulin
            - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)
              run: cargo clippy --all-targets --all-features -- -D warnings
            - name: Run tests
              run: cargo test --all-targets --all-features
            - name: Run cargo-tarpaulin
              run: cargo tarpaulin --out Xml --all-features

            - name: Upload to codecov.io
              uses: codecov/codecov-action@v6
              with:
                  token: ${{secrets.CODECOV_TOKEN}}

    build:
        name: ${{ matrix.job.os }} (${{ matrix.job.target }})
        runs-on: ${{ matrix.job.os }}
        strategy:
            fail-fast: false
            matrix:
                job:
                    - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
                    - { os: macos-latest, target: x86_64-apple-darwin }
                    - { os: windows-latest, target: x86_64-pc-windows-gnu }
        steps:
            - name: Checkout source code
              uses: actions/checkout@v6

            - name: Install Rust toolchain
              uses: moonrepo/setup-rust@v1
              with:
                  channel: stable
                  targets: ${{ matrix.job.target }}

            - name: Run tests
              run: cargo test --all-features --target ${{ matrix.job.target }}

    release:
        if: startsWith(github.ref, 'refs/tags/')
        runs-on: ubuntu-latest
        permissions:
            contents: write
        steps:
            - name: Checkout
              uses: actions/checkout@v6
              with:
                  fetch-depth: 0

            - name: Conventional Changelog Action
              id: changelog
              uses: TriPSs/conventional-changelog-action@v6
              with:
                  github-token: ${{ secrets.GITHUB_TOKEN }}
                  output-file: "false"
                  skip-version-file: "true"
                  skip-commit: "true"
                  skip-tag: "true"
                  # Our version tags have no "v" prefix (e.g. 0.2.1), so the
                  # action must not assume the default "v" prefix.
                  tag-prefix: ""
                  # The tag push checks out a detached HEAD, so the action's
                  # `git pull --ff-only` fails ("not currently on a branch").
                  # We already have full history (fetch-depth: 0) and only need
                  # the changelog output, so skip the pull and any pushes.
                  skip-git-pull: "true"
                  git-push: "false"

            - name: Update Release with Changelog
              uses: softprops/action-gh-release@v3
              with:
                  body: |
                      ${{steps.changelog.outputs.clean_changelog}}
              env:
                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

    publish:
        # Publish to crates.io via Trusted Publishing (OIDC): no long-lived
        # token is stored. Only runs on tags, and only once the tests pass.
        if: startsWith(github.ref, 'refs/tags/')
        needs: [lint, build]
        runs-on: ubuntu-latest
        environment: release
        permissions:
            id-token: write
            contents: read
        steps:
            - name: Checkout
              uses: actions/checkout@v6

            - name: Install Rust toolchain
              uses: moonrepo/setup-rust@v1
              with:
                  channel: stable

            - name: Authenticate with crates.io
              id: auth
              uses: rust-lang/crates-io-auth-action@v1

            - name: Publish to crates.io
              run: cargo publish --locked --token ${{ steps.auth.outputs.token }}