From 05e86c243c67151fce091af5b54b30717cbc60cb Mon Sep 17 00:00:00 2001 From: Autumn Date: Tue, 30 Jul 2024 13:03:17 -0700 Subject: [PATCH] build: show changes since url --- .github/workflows/release.yml | 5 +++-- CHANGES.rst.template | 19 +++++++++++-------- pyproject.toml | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e196bff..a96bc66 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -135,7 +135,7 @@ jobs: id: version run: | echo "CURRENT_VERSION=$(grep -vE '^#' CURRENT_VERSION.txt | head -1)" >> "$GITHUB_OUTPUT" - echo "CHANGELOG_VERSION=$(invoke last-logged-changes | head -1 | cut -f2 -d' ')" >> "$GITHUB_OUTPUT" + echo "CHANGELOG_VERSION=$(invoke last-logged-changes | head -1 | cut -f2 -d' ' | tr -d '`')" >> "$GITHUB_OUTPUT" echo "GIT_VERSION=$(echo '${{ github.ref_name }}' | sed 's/^.//')" >> "$GITHUB_OUTPUT" - @@ -156,7 +156,8 @@ jobs: id: artifacts run: | invoke build --validate - invoke last-logged-changes | tee RELEASE_NOTES.rst + printf '%s\n=======================\n\n' '${{ steps.version.outputs.CURRENT_VERSION }}' | tee RELEASE_NOTES.rst + invoke last-logged-changes | tee -a RELEASE_NOTES.rst invoke checksum | tee -a RELEASE_NOTES.rst - diff --git a/CHANGES.rst.template b/CHANGES.rst.template index d38aacd..6cc0338 100644 --- a/CHANGES.rst.template +++ b/CHANGES.rst.template @@ -19,6 +19,10 @@ {{ s }} {%- endif -%} {%- endmacro -%} +{#- macro: render_dashes_for -#} +{%- macro render_dashes_for(count) -%} +{{ '-' * (count + 2) }} +{%- endmacro -%} {#- macro: render_section -#} {%- macro render_section(section, default_type_name="") -%} @@ -31,10 +35,6 @@ {%- endmacro -%} {#- macro: render_version -#} -{# -`{{ version.tag or version.planned_tag }} <{{ version.url }}>`_ -`Compare with {{ version.previous_version.tag|default("first commit") }} <{{ version.compare_url }}>`_ -#} {%- macro render_version(version, show_unreleased=False) -%} {%- if version.tag or version.planned_tag -%} {{ _render_version(version) }} @@ -44,15 +44,18 @@ {%- endmacro -%} {%- macro _render_version(version) -%} {%- if version.tag or version.planned_tag -%} -Version {{ version.tag or version.planned_tag }} -------------------- +Version `{{ version.tag or version.planned_tag }} <{{ version.url }}>`_ +{{ render_dashes_for(9 + (version.tag or version.planned_tag).__len__() + 2 + (version.url).__len__() + 3) }} + +Released {% if version.date %}{{ version.date }}{%else%}YYYY-MM-DD{% endif %} + +`Compare with {{ version.previous_version.tag|default("first commit") }} <{{ version.compare_url }}>`_ ({{ version.commits | length }} commits since) -Release {% if version.date %}{{ version.date }}{%else%}YYYY-MM-DD{% endif %} {%- else -%} Unreleased Version ------------------- -Release ????-??-?? {% if not (version.tag or version.planned_tag) %}(`latest <{{ version.compare_url }}>`_){% endif %} +Released ????-??-?? {% if not (version.tag or version.planned_tag) %}(`latest <{{ version.compare_url }}>`_){% endif %} {%- endif %} {% for type in changelog.sections %} {%- if type in version.sections_dict %} diff --git a/pyproject.toml b/pyproject.toml index 8de68f4..ba22e94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ input = 'CHANGES.rst' convention='conventional' marker_line = '.. |Changes|' template = 'path:CHANGES.rst.template' -version_regex = '^Version (?Pv?[\w\d\.\+]+)' +version_regex = '^Version `?(?Pv?[\w\d\.\+]+)' filter_commits = 'ade6cd882d2771f4abe9927e78614886f7f01ad6..' parse_trailers = true parse_refs = true