name: Generate Changelog

on:
  push:
    tags:
      - "v*"

jobs:
  changelog:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0

      - name: Generate changelog with git-cliff
        uses: orhun/git-cliff-action@4d0efd7c7a4b55484abf71c29a29712192adebdb
        with:
          config: cliff.toml
          args: --verbose

      - name: Upload artifacts
        uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b
        with:
          body_path: CHANGELOG.md
          draft: false
          prerelease: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
