Skip to content

Commit 6fa17ba

Browse files
authored
docs: DOC-752 copies changelog on docs build and adds to sidebar menu (#1345)
Copies the changelog during sphinx build step into the docs for publishing. Adds it to the sidebar. Downside of this approach is that page 404s in local render, but this seems like the easiest way to implement. During this change I discovered our cog template wasn't actually being used. The default template had some invalid JSX in the form of html style="" spans around the word breaking. When I went to remove that I discovered our template wasn't actually being used at all. `cog bump --package` changelog uses the `package_template` which was unset, so our template was never actually used. I made additional changes to the template to correct whitespace in output, and add PR links, and adjust the output heading. Finally, I added a script that can regen the changelog, to back fix all the old changelog entries.
1 parent ec7e91d commit 6fa17ba

8 files changed

Lines changed: 1369 additions & 603 deletions

File tree

cog.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,28 @@ ci = { changelog_title = "", omit_from_changelog = true }
4949
[changelog]
5050
path = "CHANGELOG.md"
5151
template = "deephaven-changelog-template"
52+
package_template = "deephaven-changelog-template"
5253
remote = "github.com"
5354
repository = "deephaven-plugins"
5455
owner = "deephaven"
56+
# `signature` must match `git log --format=%an` exactly. `username` is the
57+
# github handle, which is what `commit.author` resolves to in the changelog
58+
# template — that's what we render. Multiple entries per handle cover
59+
# historical git-author name variants (e.g. "Joe" vs "Joe Numainville").
5560
authors = [
5661
{ username = "jnumainville", signature = "Joe Numainville" },
62+
{ username = "jnumainville", signature = "Joe" },
5763
{ username = "mofojed", signature = "Mike Bender" },
64+
{ username = "mofojed", signature = "mikebender" },
5865
{ username = "devinrsmith", signature = "Devin Smith" },
59-
{ username = "mattrunyon", signature = "Matt Runyon" },
66+
{ username = "mattrunyon", signature = "Matthew Runyon" },
6067
{ username = "vbabich", signature = "Vlad Babich" },
68+
{ username = "dsmmcken", signature = "Don" },
6169
{ username = "dsmmcken", signature = "Don McKenzie" },
6270
{ username = "bmingles", signature = "Brian Ingles" },
6371
{ username = "niloc132", signature = "Colin Alworth" },
6472
{ username = "rachelmbrubaker", signature = "Rachel Brubaker" },
6573
{ username = "JamesXNelson", signature = "James Nelson" },
66-
6774
]
6875

6976
[bump_profiles]

deephaven-changelog-template

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,51 @@
1-
{# Tera templates are used to generate the changelog content -#}
2-
{# https://keats.github.io/tera/docs/ -#}
3-
{# Based on Cocogittos remote template, but adds breaking changes: https://github.com/cocogitto/cocogitto/blob/main/src/conventional/changelog/template/remote -#}
4-
{# First display all the breaking changes -#}
5-
{% set breaking_commits = commits | filter(attribute="breaking_change", value=true) -%}
6-
{% if breaking_commits | length > 0 -%}
7-
#### ⚠ Breaking Changes
1+
{%- if version.tag %}
2+
## {{ version.tag }} - {{ date | date(format="%Y-%m-%d") }}
3+
{% else %}
4+
{%- set from = commits | last -%}
5+
{%- set to = version.id -%}
6+
{%- set from_shorthand = from.id | truncate(length=7, end="") -%}
7+
{%- set to_shorthand = to | truncate(length=7, end="") %}
8+
## Unreleased ({{ from_shorthand ~ ".." ~ to_shorthand }})
9+
{% endif -%}
10+
{%- set breaking_commits = commits | filter(attribute="breaking_change", value=true) -%}
11+
{%- if breaking_commits | length > 0 %}
12+
#### Breaking Changes
813

914
{% for commit in breaking_commits -%}
10-
{% set commit_link = repository_url ~ "/commit/" ~ commit.id -%}
11-
{% set shorthand = commit.id | truncate(length=7, end="") -%}
12-
{% for footer in commit.footer | filter(attribute="token", value="BREAKING CHANGE") -%}
13-
- {{ footer.content }} - ([{{shorthand}}]({{ commit_link }}))
15+
{%- set parts = commit.summary | split(pat=" (#") -%}
16+
{%- if parts | length > 1 -%}
17+
{%- set pr_num = parts | last | replace(from=")", to="") -%}
18+
- {{ parts | first }} ([#{{ pr_num }}]({{ repository_url }}/pull/{{ pr_num }})) - ({{ commit.id | truncate(length=7, end="") }}) - {{ commit.author | default(value=commit.signature) }}
19+
{% else -%}
20+
- {{ commit.summary }} - ({{ commit.id | truncate(length=7, end="") }}) - {{ commit.author | default(value=commit.signature) }}
21+
{% endif -%}
1422
{% endfor -%}
15-
{% endfor -%}
16-
{% endif %}
17-
18-
{# Now group the rest of the commits and display them -#}
19-
{% set typed_commit_map = commits | group_by(attribute="type") -%}
20-
{% set type_order = ["Features", "Bug Fixes", "Performance Improvements", "Miscellaneous Chores", "Documentation", "Refactoring", "Build system", "Style"] -%}
21-
{% for type in type_order -%}
22-
{% if typed_commit_map[type] -%}
23+
{%- endif -%}
24+
{%- set typed_commit_map = commits | group_by(attribute="type") -%}
25+
{%- set type_order = ["Features", "Bug Fixes", "Performance Improvements", "Miscellaneous Chores", "Documentation", "Refactoring", "Revert", "Tests", "Build system", "Style"] -%}
26+
{%- for type in type_order -%}
27+
{%- if typed_commit_map[type] %}
2328
#### {{ type | upper_first }}
24-
{% for scope, scoped_commits in typed_commit_map[type] | group_by(attribute="scope") -%}
2529

30+
{% for scope, scoped_commits in typed_commit_map[type] | group_by(attribute="scope") -%}
2631
{% for commit in scoped_commits | sort(attribute="scope") -%}
27-
{% if commit.author and repository_url -%}
28-
{% set author = "@" ~ commit.author -%}
29-
{% set author_link = platform ~ "/" ~ commit.author -%}
30-
{% set author = "[" ~ author ~ "](" ~ author_link ~ ")" -%}
31-
{% else -%}
32-
{% set author = commit.signature -%}
33-
{% endif -%}
34-
{% set commit_link = repository_url ~ "/commit/" ~ commit.id -%}
35-
{% set shorthand = commit.id | truncate(length=7, end="") -%}
36-
- **({{ scope }})** {{ commit.summary }} - ([{{shorthand}}]({{ commit_link }})) - {{ author }}
32+
{%- set parts = commit.summary | split(pat=" (#") -%}
33+
{%- if parts | length > 1 -%}
34+
{%- set pr_num = parts | last | replace(from=")", to="") -%}
35+
- **({{ commit.scope }})** {{ parts | first }} ([#{{ pr_num }}]({{ repository_url }}/pull/{{ pr_num }})) - ({{ commit.id | truncate(length=7, end="") }}) - {{ commit.author | default(value=commit.signature) }}
36+
{% else -%}
37+
- **({{ commit.scope }})** {{ commit.summary }} - ({{ commit.id | truncate(length=7, end="") }}) - {{ commit.author | default(value=commit.signature) }}
38+
{% endif -%}
3739
{% endfor -%}
38-
3940
{% endfor -%}
40-
4141
{% for commit in typed_commit_map[type] | unscoped -%}
42-
{% if commit.author and repository_url -%}
43-
{% set author = "@" ~ commit.author -%}
44-
{% set author_link = platform ~ "/" ~ commit.author -%}
45-
{% set author = "[" ~ author ~ "](" ~ author_link ~ ")" -%}
46-
{% else -%}
47-
{% set author = commit.signature -%}
48-
{% endif -%}
49-
{% set commit_link = repository_url ~ "/commit/" ~ commit.id -%}
50-
{% set shorthand = commit.id | truncate(length=7, end="") -%}
51-
- {{ commit.summary }} - ([{{shorthand}}]({{ commit_link }})) - {{ author }}
42+
{%- set parts = commit.summary | split(pat=" (#") -%}
43+
{%- if parts | length > 1 -%}
44+
{%- set pr_num = parts | last | replace(from=")", to="") -%}
45+
- {{ parts | first }} ([#{{ pr_num }}]({{ repository_url }}/pull/{{ pr_num }})) - ({{ commit.id | truncate(length=7, end="") }}) - {{ commit.author | default(value=commit.signature) }}
46+
{% else -%}
47+
- {{ commit.summary }} - ({{ commit.id | truncate(length=7, end="") }}) - {{ commit.author | default(value=commit.signature) }}
48+
{% endif -%}
5249
{% endfor -%}
53-
{% endif %}
54-
{% endfor -%}
50+
{%- endif -%}
51+
{%- endfor -%}

0 commit comments

Comments
 (0)