hddfancontrol 2.0.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@v4
        with:
          fetch-depth: 0
          fetch-tags: true
      - uses: taiki-e/install-action@v2
        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@v1
        with:
          body_path: CHANGELOG_${{ github.ref_name }}.md
          token: ${{ secrets.GITHUB_TOKEN }}

  bin-amd64-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        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@v1
        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@v4
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          target: x86_64-unknown-linux-gnu
      - run: |
          mkdir -p target/man
          cargo run --features gen-man-pages -- target/man
          gzip -9 target/man/*.1
      - uses: taiki-e/install-action@v2
        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@v1
        with:
          files: target/x86_64-unknown-linux-gnu/debian/hddfancontrol_*.deb
          token: ${{ secrets.GITHUB_TOKEN }}