Skip to content

Instantly share code, notes, and snippets.

@dleidert
Last active February 26, 2019 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dleidert/195a3dacb6906f0f1133bf1aff449f4b to your computer and use it in GitHub Desktop.
Save dleidert/195a3dacb6906f0f1133bf1aff449f4b to your computer and use it in GitHub Desktop.
Automatically create changelog / news page for last 5 releases using Jekyll and GitHub Pages
{%- assign releases = site.github.releases | where: "draft", false | sort: "tag_name" | reverse -%}

## [UNRELEASED]({{ site.github.repository_url }}/tree/master/)

[compare changes to last release]({{ site.github.repository_url }}/compare/{{ releases[0].tag_name }}...master#files_bucket "Compare changes in master for upcoming release")

{% for release in releases limit:5 %}

## [{{ release.name }}]({{ release.html_url }}) {% if release.prerelease -%}(pre-release){%- endif %}

Released <time datetime="{{ release.published_at | date_to_xmlschema }}">{{ release.published_at | date_to_string }}</time>
{% unless release.tag_name == "v0.0.1" -%}
([compare changes to previous release]({{ site.github.repository_url }}/compare/{{ releases[forloop.index].tag_name }}...{{ release.tag_name }}#files_bucket "Compare changes between release versions {{ releases[forloop.index].tag_name }} and {{ release.tag_name }}"))
{%- endunless %}

{{ release.body }}

{% endfor %}
@dleidert
Copy link
Author

I use this approach in this github page (source). In this example I even access the newest release draft information (including the designated tag name and release notes), which is exposed via the site.github namespace too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment