diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b11be9..012f9b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,15 +32,14 @@ jobs: echo "version does not match Cargo.toml" >&2 exit 1 fi - - name: Prepare cliff config - run: | - sed -i 's#$REPO#${{ github.server_url }}/${{ github.repository }}#g' cliff-gh.toml - name: Generate a changelog uses: orhun/git-cliff-action@v4 id: git-cliff with: - config: cliff-gh.toml + config: cliff.toml args: --latest --strip all + env: + REPO_PREFIX: ${{ github.server_url }}/${{ github.repository }}/ - name: Create GitHub release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/cliff-gh.toml b/cliff-gh.toml deleted file mode 100644 index 59aee6a..0000000 --- a/cliff-gh.toml +++ /dev/null @@ -1,29 +0,0 @@ -[changelog] -body = """ -{% if version %}\ - ## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }} -{% else %}\ - ## Unreleased -{% endif %}\ -{% if previous %}\ - {% if previous.version and version %} - ### Diff - - [{{ previous.version }}...{{ version }}]($REPO/compare/{{ previous.version }}...{{ version }}) - {% endif %}\ -{% endif %}\ -{% for group, commits in commits | group_by(attribute="group") %} - ### {{ group | upper_first }} - {% for commit in commits %} - - {{ commit.message | split(pat="\n") | first | trim }} [#{{ commit.id | truncate(length=7, end="") }}]($REPO/commit/{{ commit.id }})\ - {% endfor %} -{% endfor %}\n -""" - -[git] -filter_unconventional = false -conventional_commits = false -commit_parsers = [ - { message = "^chore: Release", skip = true}, - { message = "^", group = "Changelog"}, -] diff --git a/cliff.toml b/cliff.toml index 2d1d8c1..d4e6d7e 100644 --- a/cliff.toml +++ b/cliff.toml @@ -1,5 +1,6 @@ [changelog] body = """ +{% set repo_prefix = get_env(name="REPO_PREFIX", default="") %} {% if version %}\ ## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ @@ -9,13 +10,13 @@ body = """ {% if previous.version and version %} ### Diff - [{{ previous.version }}...{{ version }}](compare/{{ previous.version }}...{{ version }}) + [{{ previous.version }}...{{ version }}]({{repo_prefix}}compare/{{ previous.version }}...{{ version }}) {% endif %}\ {% endif %}\ {% for group, commits in commits | group_by(attribute="group") %} ### {{ group | upper_first }} {% for commit in commits %} - - {{ commit.message | split(pat="\n") | first | trim }} [#{{ commit.id | truncate(length=7, end="") }}](commit/{{ commit.id }})\ + - {{ commit.message | split(pat="\n") | first | trim }} [#{{ commit.id | truncate(length=7, end="") }}]({{repo_prefix}}commit/{{ commit.id }})\ {% endfor %} {% endfor %}\n """