Sort changelogs by release date

This commit is contained in:
Richard van der Hoff 2022-11-15 23:03:38 +00:00
parent 78a673718f
commit 46596d750a
6 changed files with 21 additions and 4 deletions

View file

@ -1,3 +1,6 @@
---
date: 1636416000
---
<!-- <!--
This is a header file for the generated changelog. This is a header file for the generated changelog.

View file

@ -1,3 +1,6 @@
---
date: 1643760000
---
<!-- <!--
This is a header file for the generated changelog. This is a header file for the generated changelog.

View file

@ -1,3 +1,6 @@
---
date: 1655247600
---
<!-- <!--
This is a header file for the generated changelog. This is a header file for the generated changelog.

View file

@ -1,3 +1,6 @@
---
date: 1664406000
---
<!-- <!--
This is a header file for the generated changelog. This is a header file for the generated changelog.

View file

@ -4,7 +4,7 @@
*/}} */}}
{{ with .Page.Resources.Match "*.md" }} {{ with .Page.Resources.Match "*.md" }}
{{ range ((sort . "Name" "desc")) }} {{ range ((sort . "Params.date" "desc")) }}
{{ .Content }} {{ .Content }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -25,10 +25,15 @@ towncrier --name "Client-Server API" --dir "./client_server" --config "./pyproje
{ {
# Prepare the header # Prepare the header
if [ "$VERSION" = "vUNSTABLE" ]; then # We include the generation date in the front matter so that we can use it
cat <<EOF # to sort the changelogs at build time.
## Changes since last release cat <<EOF
---
date: $(date +%s)
---
EOF EOF
if [ "$VERSION" = "vUNSTABLE" ]; then
echo "## Changes since last release"
else else
sed -e "s/VERSION/$1/g" -e "s/DATE/$2/g" header.md sed -e "s/VERSION/$1/g" -e "s/DATE/$2/g" header.md
fi fi