mit-commit 0.14.0

For building commit linters. This makes it eas.
Documentation
"on":
  push:
    branches:
      - "*"
  pull_request: null
jobs:
  security-audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.1
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/audit-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
  version:
    runs-on: ubuntu-latest
    steps:
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          default: true
      - uses: actions/checkout@v2.3.1
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
      - id: get_previous_version
        run: echo ::set-output name=PREVIOUS_VERSION::$(git tag | sort --version-sort | tail -n 1)
        shell: bash
      - id: semvers
        uses: WyriHaximus/github-action-next-semvers@master
        with:
          version: "${{ steps.get_previous_version.outputs.PREVIOUS_VERSION }}"
      - run: mkdir -p ./version
      - if: "!contains(github.event.head_commit.message, 'BC BREAK') && !contains(github.event.head_commit.message, 'Signed-off-by: dependabot-preview[bot] <support@dependabot.com>')"
        run: echo "$VERSION" >./version/version
        env:
          VERSION: ${{ steps.semvers.outputs.v_minor }}
      - if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
        run: echo "$VERSION" >./version/version
        env:
          VERSION: ${{ steps.semvers.outputs.v_patch }}
      - run: echo "$VERSION" > ./version/version
        env:
          VERSION: ${{ steps.semvers.outputs.v_major }}
        if: "contains(github.event.head_commit.message, 'BC BREAK')"
      - uses: actions/upload-artifact@v2
        with:
          name: version
          path: ./version/version
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.1
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          default: true
      - uses: actions-rs/cargo@v1
        with:
          command: check
  test:
    runs-on: "${{ matrix.os }}"
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.1
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          default: true
      - uses: actions-rs/cargo@v1
        with:
          command: test
  lints:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.1
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          default: true
          components: "rustfmt, clippy"
      - uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: "--all -- --check"
      - uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: "--all-targets --all-features -- -D warnings -Dclippy::all -D clippy::pedantic -D clippy::cargo"
      - name: Prettify code
        uses: creyD/prettier_action@v3.0
        with:
          prettier_options: --check **/*.{yml,yaml}
  publish-to-cargo:
    if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'Release v')
    needs:
      - version
      - test
      - lints
      - check
      - security-audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.1
        with:
          token: "${{ secrets.COMMITTER_TOKEN }}"
          fetch-depth: 0
      - env:
          CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
        run: |
          cargo login "$CARGO_TOKEN"
          cargo publish
  merge-and-push:
    if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'Release v')
    needs:
      - version
      - test
      - lints
      - check
      - security-audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.1
        with:
          token: "${{ secrets.COMMITTER_TOKEN }}"
          fetch-depth: 0
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - uses: actions/download-artifact@v2
      - id: get_current_version
        run: |
          echo ::set-output name=VERSION::$(cat ./version/version | cut -c2-)
          echo ::set-output name=V_VERSION::$(cat ./version/version)
        shell: bash
      - uses: ciiiii/toml-editor@1.0.0
        with:
          file: "Cargo.toml"
          key: "package.version"
          value: ${{ steps.get_current_version.outputs.VERSION }}
      - uses: actions-rs/cargo@v1
        with:
          command: check
      - shell: bash
        env:
          GITHUB_ACTOR: ${{ github.actor }}
          GITHUB_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
        run: |
          git config user.name "$GITHUB_ACTOR"
          git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
          git commit -am "Release $(cat ./version/version)"
          git tag -a -m "Release $(cat ./version/version)" "$(cat ./version/version)"
          git push --tags

          git checkout -b "release-$(cat ./version/version)"
          git push -f origin "release-$(cat ./version/version)"
          gh pr create -l releases --fill