diff --git a/.cliff.toml b/.cliff.toml new file mode 100644 index 00000000..f95cb91f --- /dev/null +++ b/.cliff.toml @@ -0,0 +1,40 @@ +# git-cliff ~ configuration file + +[changelog] +body = """ +## What's Changed {%- if version %} in {{ version }}{%- endif -%} + +{% for commit in commits %} + {%- if commit.remote.pr_title %} + * {{ commit.remote.pr_title | split(pat="\n") | first | trim }}\ + {% if commit.remote.pr_number %} ([#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }})){%- endif -%} + {%- endif -%} +{%- endfor -%} + +{% if version %} + {% if previous.version %} + **Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }} + {% endif %} +{% else -%} + {% raw %}\n{% endraw %} +{% endif %} + +{%- macro remote_url() -%} + https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} +{%- endmacro -%} +""" +trim = true +postprocessors = [] + +[git] +conventional_commits = false +filter_unconventional = true +split_commits = false +filter_commits = false +topo_order = false +sort_commits = "newest" + +commit_parsers = [ + { field = "github.pr_title", pattern = "build\\(deps.*\\)", skip = true }, + { field = "github.pr_title", pattern = "chore\\(release\\)", skip = true }, +] \ No newline at end of file diff --git a/.github/chglog/CHANGELOG.tpl.md b/.github/chglog/CHANGELOG.tpl.md deleted file mode 100755 index 52cbcfdf..00000000 --- a/.github/chglog/CHANGELOG.tpl.md +++ /dev/null @@ -1,30 +0,0 @@ -{{ range .Versions }} - -## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }}) - -{{ range .CommitGroups -}} -### {{ .Title }} - -{{ range .Commits -}} -* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ upperFirst .Subject }} -{{ end }} -{{ end -}} - -{{- if .RevertCommits -}} -### Reverts - -{{ range .RevertCommits -}} -* {{ .Revert.Header }} -{{ end }} -{{ end -}} - -{{- if .NoteGroups -}} -{{ range .NoteGroups -}} -### {{ .Title }} - -{{ range .Notes }} -{{ upperFirst .Body }} -{{ end }} -{{ end -}} -{{ end -}} -{{ end -}} diff --git a/.github/chglog/config.yml b/.github/chglog/config.yml deleted file mode 100755 index b3ebbd60..00000000 --- a/.github/chglog/config.yml +++ /dev/null @@ -1,39 +0,0 @@ -style: github -template: CHANGELOG.tpl.md -info: - title: CHANGELOG - repository_url: https://github.com/powerapi-ng/powerapi -options: - commits: - filters: - Type: - - feat - - fix - - perf - - refactor - - style - - docs - - test - - build - - ci - - chore - commit_groups: - title_maps: - feat: Features - fix: Bug Fixes - perf: Performance Improvements - refactor: Code Refactoring - docs: Documentation - test: Tests - build: Build System - ci: Continuous Integration - chore: Miscellaneous Chores - header: - pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\/\\s]*)\\))?\\:\\s(.*)$" - pattern_maps: - - Type - - Scope - - Subject - notes: - keywords: - - BREAKING CHANGE diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1239087f..469f043d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -146,14 +146,12 @@ jobs: POWERAPI_INSTALL_METHOD=pypi POWERAPI_VERSION=${{ steps.meta.outputs.version }} - github-release: - name: Publish GitHub release + generate-release-notes: + name: Generate release notes runs-on: ubuntu-latest - needs: [publish-python-package, docker-image] + needs: [pre-checks] permissions: - contents: write - env: - CHGLOG_VERSION: "0.15.4" + contents: read steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -161,12 +159,33 @@ jobs: fetch-depth: 0 - name: Generate version changelog - run: | - set -euo pipefail - export BASE_URL="https://github.com/git-chglog/git-chglog/releases/download" - export FILENAME="git-chglog_${CHGLOG_VERSION}_linux_amd64.tar.gz" - curl -fsSL "${BASE_URL}/v${CHGLOG_VERSION}/${FILENAME}" |sudo tar xz --no-same-owner -C /usr/local/bin git-chglog - git-chglog --config .github/chglog/config.yml --output CHANGELOG.md "${GITHUB_REF_NAME}" + uses: orhun/git-cliff-action@c93ef52f3d0ddcdcc9bd5447d98d458a11cd4f72 # v4.7.1 + with: + config: .cliff.toml + args: --no-exec --latest + env: + OUTPUT: CHANGELOG.md + GITHUB_REPO: ${{ github.repository }} + + - name: Upload release notes artifact + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: "release-notes" + path: CHANGELOG.md + if-no-files-found: error + + github-release: + name: Publish GitHub release + runs-on: ubuntu-latest + needs: [publish-python-package, docker-image, generate-release-notes] + permissions: + contents: write + + steps: + - name: Download release notes artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: "release-notes" - name: Create GitHub release uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1