hddfancontrol 2.1.2

Daemon to regulate fan speed according to hard drive temperature on Linux
name: Release

permissions:
  contents: write

on:
  push:
    tags:
      - "*.*.**"
      - "*.*.*.**"

env:
  CARGO_TERM_COLOR: always

jobs:
  changelog-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          fetch-depth: 0
          fetch-tags: true
      - uses: taiki-e/install-action@9e1e5806d4a4822de933115878265be9aaa786d9 # v2.82.2
        with:
          tool: git-cliff
      - run: git cliff -o CHANGELOG_${{ github.ref_name }}.md $(git tag -l | sort -V | tail -n -2 | head -n -1)..HEAD
      - uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1
        with:
          body_path: CHANGELOG_${{ github.ref_name }}.md
          token: ${{ secrets.GITHUB_TOKEN }}

  bin-amd64-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
        with:
          profile: minimal
          toolchain: stable
          target: x86_64-unknown-linux-gnu
      - run: cargo build --release --target x86_64-unknown-linux-gnu
        env:
          RUSTFLAGS: "-C target-feature=+crt-static"
      - run: |
          cd target/x86_64-unknown-linux-gnu/release/
          tar -cJvf hddfancontrol_${{ github.ref_name }}_amd64.tar.xz hddfancontrol
      - uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1
        with:
          files: target/x86_64-unknown-linux-gnu/release/hddfancontrol*.tar.xz
          token: ${{ secrets.GITHUB_TOKEN }}

  deb-amd64-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
        with:
          profile: minimal
          toolchain: stable
          target: x86_64-unknown-linux-gnu
      - run: |
          mkdir -p target/man
          cargo run --features generate-extras -- gen-man-pages target/man
          rm target/man/hddfancontrol-gen-*
          gzip -9 target/man/*.1
          mkdir -p target/shell-completions
          cargo run --features generate-extras -- gen-shell-completions target/shell-completions
      - uses: taiki-e/install-action@9e1e5806d4a4822de933115878265be9aaa786d9 # v2.82.2
        with:
          tool: cargo-deb
      - run: cargo deb --target x86_64-unknown-linux-gnu
        env:
          RUSTFLAGS: "-C target-feature=+crt-static"
      - uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1
        with:
          files: target/x86_64-unknown-linux-gnu/debian/hddfancontrol_*.deb
          token: ${{ secrets.GITHUB_TOKEN }}