mit-commit 3.1.8

For building commit linters. This makes it eas.
Documentation
name: Test
on:
  push:
    branches:
      - "*"
  pull_request:
  workflow_dispatch:

jobs:
  lint-markdown:
    uses: PurpleBooth/common-pipelines/.github/workflows/markdown-check.yml@main
  commit-checks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@main
        with:
          fetch-depth: 0
      - name: Get tags
        run: git fetch --tags origin
      - shell: bash
        run: cargo install --locked cocogitto
      - id: previous_version
        run: cog check --from-latest-tag

  rust-checks:
    uses: PurpleBooth/common-pipelines/.github/workflows/rust-check.yml@main
    with:
      run_minimal_version_check: true

  release:
    if: github.ref == 'refs/heads/main'
    needs:
      - lint-markdown
      - commit-checks
      - rust-checks
    outputs:
      version_bump: ${{ steps.current_version.outputs.current_version != steps.previous_version.outputs.previous_version }}
      current_version: ${{ steps.current_version.outputs.current_version }}
      previous_version: ${{ steps.previous_version.outputs.previous_version }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@main
        with:
          fetch-depth: 0
      - name: Get tags
        run: git fetch --tags origin
      - shell: bash
        run: cargo install cargo-edit
      - shell: bash
        run: cargo install --locked cocogitto
      - id: previous_version
        run: |
          cog get-version | tee .version
          echo "previous_version=$( cat .version )"  >> "$GITHUB_OUTPUT"
          rm .version
        shell: bash
      - name: Semver release
        id: release
        run: |
          git config --global user.name "cog-bot"
          git config --global user.email "cog@example.com"
          cog bump --auto
      - id: current_version
        run: |
          cog get-version | tee .version
          echo "current_version=$( cat .version )"  >> "$GITHUB_OUTPUT"
          rm .version
        shell: bash

  publish-to-cargo:
    if: needs.release.outputs.version_bump
    needs:
      - release
    uses: PurpleBooth/common-pipelines/.github/workflows/release-rust-library.yml@main
    with:
      current_version: ${{ needs.release.outputs.current_version }}
      previous_version: ${{ needs.release.outputs.previous_version }}
    secrets:
      cargo_token: ${{ secrets.CARGO_TOKEN }}