gf-metadata 0.2.4

A metadata reader for Google Fonts.
Documentation
name: Rust

on:
  - push
  - pull_request
  - merge_group

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always
  GH_TOKEN: ${{ github.token }}
  PROJECT_NAME: gf-metadata
  CARGO_PUBLISH_ARGS: ""
  CRATE_PATTERN: "gf-metadata"

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
      - uses: dtolnay/rust-toolchain@stable
        name: Set up Rust for caching
      - name: Build
        run: cargo build
      - name: Run tests
        run: |
          cargo test --verbose --workspace 

  formatting:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
      - uses: dtolnay/rust-toolchain@stable
        name: Set up Rust for caching
        with:
          components: rustfmt

      - name: Lint for formatting
        run: cargo fmt --all -- --check
  lint:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
      - uses: dtolnay/rust-toolchain@stable
        name: Set up Rust for caching
        with:
          components: clippy
      - name: Lint for warnings
        run: cargo clippy --all-targets --all-features -- -D warnings

  check-for-release:
    name: Create release if needed (Python will race us)
    runs-on: ubuntu-latest
    permissions:
      contents: write
      id-token: write
    steps:
      - uses: actions/checkout@v3
      - if: contains(github.ref, 'refs/tags/v')
        name: Check for release
        id: create_release
        run: |
          if ! gh release view ${{ github.ref_name }}; then
          git show -s --format=%B ${{ github.ref_name }} | tail -n +4 | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -F -
          fi

  publish-crate:
    runs-on: ubuntu-latest
    if: contains(github.ref, 'refs/tags/v')
    needs: build

    steps:
        - uses: actions/checkout@v3
        - uses: dtolnay/rust-toolchain@stable
        - run:
            cargo publish ${{ env.CARGO_PUBLISH_ARGS }} --no-verify
          env:
              CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}