automatic-timezoned 1.0.42

Automatically update system timezone based on location
name: build

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

concurrency:
  group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
  cancel-in-progress: true

env:
  RUSTFLAGS: --deny warnings
  RUSTDOCFLAGS: --deny warnings

jobs:
  test:
    runs-on: ubuntu-latest

    timeout-minutes: 10

    steps:
      - name: Checkout repository
        uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
        with:
          fetch-depth: 2

      - name: Set up Rust
        run: rustup show

      - name: Set up Rust cache
        uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0

      - name: Test
        run: cargo test

  lint:
    runs-on: ubuntu-latest

    timeout-minutes: 10

    steps:
      - name: Checkout repository
        uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
        with:
          fetch-depth: 2

      - name: Set up Rust
        run: rustup show

      - name: Set up Rust cache
        uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0

      - name: Run clippy
        run: cargo clippy

      - name: Run doc
        run: cargo doc

      - name: Run fmt
        run: cargo fmt --check

  audit:
    runs-on: ubuntu-latest

    timeout-minutes: 10

    steps:
      - name: Checkout repository
        uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
        with:
          fetch-depth: 2

      - name: Set up Rust
        run: rustup show

      - name: Set up Rust cache
        uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0

      - name: Set up cargo-audit
        run: cargo install --locked cargo-audit --version "${CARGO_AUDIT_VERSION}"
        env:
          # renovate: datasource=crate depName=cargo-audit versioning=cargo
          CARGO_AUDIT_VERSION: =0.17.4

      - name: Audit
        run: cargo audit --deny warnings

  build:
    runs-on: ubuntu-latest

    timeout-minutes: 10

    steps:
      - name: Checkout repository
        uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
        with:
          fetch-depth: 2

      - name: Set up Rust
        run: rustup show

      - name: Set up Rust cache
        uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0

      - name: Build
        run: cargo build

  semantic-release:
    needs: [audit, build, lint, test]
    if: github.event_name != 'pull_request'
    runs-on: ubuntu-latest
    permissions:
      contents: write
      issues: write
      pull-requests: write

    timeout-minutes: 10

    steps:
      # full checkout for semantic-release
      - name: Checkout repository
        uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
        with:
          fetch-depth: 0
          # Use Deploy key with write access to push changelog to main branch (protected branch)
          ssh-key: ${{ secrets.SEMANTIC_RELEASE_SSH_KEY }}

      - name: Set up Rust
        run: rustup show

      - name: Set up Rust cache
        uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0

      - name: Semantic Release
        uses: cycjimmy/semantic-release-action@8f6ceb9d5aae5578b1dcda6af00008235204e7fa # tag=v3.2.0
        id: semantic-release
        with:
          # renovate: datasource=npm depName=semantic-release
          semantic_version: 19.0.5
          extra_plugins: |
            conventional-changelog-conventionalcommits@5.0.0
            @semantic-release/changelog@6.0.1
            @semantic-release/exec@6.0.3
            @semantic-release/git@10.0.1
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}