mit-commit 1.29.10

For building commit linters. This makes it eas.
Documentation
name: Test
on:
  push:
    branches:
      - "*"
  pull_request:
jobs:
  lint-markdown:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: PurpleBooth/gfmfmt-action@v1.0.5
  security-audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
        name: Checkout the repository
      - uses: actions/cache@v2.1.6
        name: Cache cargo
        with:
          path: |
            .cache
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/audit-check@v1.2.0
        name: Audit check cargo packages
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
  version:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2.3.4
        with:
          fetch-depth: 0
      - uses: chaaz/versio-actions/install@v1.2
        name: Install versio
      - name: Check projects
        run: versio check
      - name: Print changes
        run: versio plan
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_USER: ${{ github.actor }}
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
      - uses: actions/cache@v2.1.6
        with:
          path: |
            .cache
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1.0.7
        with:
          toolchain: stable
          default: true
      - uses: actions-rs/cargo@v1.0.3
        with:
          command: check
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
      - uses: actions/cache@v2.1.6
        with:
          path: |
            .cache
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1.0.7
        with:
          toolchain: stable
          default: true
      - uses: actions-rs/cargo@v1.0.3
        with:
          command: test
  lints:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
      - uses: actions/cache@v2.1.6
        with:
          path: |
            .cache
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1.0.7
        with:
          toolchain: nightly
          default: true
          components: rustfmt, clippy
      - uses: actions-rs/cargo@v1.0.3
        with:
          command: fmt
          args: --all -- --check
      - uses: actions-rs/cargo@v1.0.3
        with:
          command: clippy
          args:
            --all-targets --all-features -- -D warnings -Dclippy::all -D clippy::pedantic
            -D clippy::cargo
      - uses: gaurav-nelson/github-action-markdown-link-check@1.0.13
  bench:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
      - uses: actions/cache@v2.1.6
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1.0.7
        with:
          profile: minimal
          toolchain: stable
          default: true
      - uses: actions-rs/cargo@v1.0.3
        with:
          command: bench
  release:
    if: github.ref == 'refs/heads/main'
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      GITHUB_USER: ${{ github.actor }}
    needs:
      - version
      - test
      - bench
      - lints
      - lint-markdown
      - check
      - security-audit
    outputs:
      version_bump: ${{ steps.version_bump.outputs.version_bump }}
      current_version: ${{ steps.current_version.outputs.current_version }}
      previous_version: ${{ steps.previous_version.outputs.previous_version }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
        with:
          fetch-depth: 0
      - uses: chaaz/versio-actions/install@v1.2
        name: Install versio
      - id: previous_version
        run: echo ::set-output "name=previous_version::$( versio get --id 1 -v )"
      - run: echo ::set-output "name=BUMP::$( versio release --dry-run )"
        id: get_versio_plan
      - name: Generate release
        if: ${{ contains(steps.get_versio_plan.outputs.BUMP, ' -> ') }}
        run: |
          versio release
      - run: echo ::set-output "name=current_version::$( versio get --id 1 -v )"
        id: current_version
      - run: echo ::set-output "name=version_bump::true"
        if: steps.current_version.outputs.current_version != steps.previous_version.outputs.previous_version
        id: version_bump

  github-release:
    needs:
      - release
    if: needs.release.outputs.version_bump
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
        name: Checkout the repository
        with:
          ref: v${{ needs.release.outputs.current_version }}
          fetch-depth: 0
      - name: Generate a changelog
        uses: orhun/git-cliff-action@v1
        with:
          config: cliff.toml
          args: --verbose --latest
        env:
          OUTPUT: CHANGELOG.md
      - env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        id: create_release
        uses: ncipollo/release-action@v1.8.9
        with:
          allowUpdates: true
          token: ${{ secrets.COMMITTER_TOKEN }}
          bodyFile: CHANGELOG.md
          name: Release v${{ needs.release.outputs.current_version }}
          tag: v${{ needs.release.outputs.current_version }}

  publish-to-cargo:
    needs:
      - release
    if: needs.release.outputs.version_bump
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
      - env:
          CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
        run: |
          cargo login "$CARGO_TOKEN"
          cargo publish