Handle Empty Arrays
Always check if your arrays are empty before looping in your template to avoid rendering empty bullet points.
Compose. Compile. Ship.
Every time you ship a new version of your product, you have to manually curate a changelog. This process is prone to human error—features get missed, typos creep in, and the tone varies from release to release. Worse, it creates a disconnect between what your engineering team actually built and what your customers see.
By treating release notes as a first-class artifact in your CI/CD pipeline, you can ensure consistency, accuracy, and speed. Texkit allows you to generate these documents programmatically from your version metadata and commit history.
The workflow is straightforward:
This decouples your documentation generation from your release process, making it fully automated and reproducible.
Create a file named release-notes.txk in your project root. This template defines the structure of your output. We'll use variables to inject the version and a list of changes.
# Release Notes Template
version: {{ version }}
date: {{ date }}
## What's New
{% for change in changes %}
- {{ change.description }}
{% if change.author %}by {{ change.author }}{% endif %}
{% endfor %}
## Fixes
{% for fix in fixes %}
- {{ fix.description }}
{% endfor %}
Texkit needs a source of truth for the version details. Create a release-data.json file. You can generate this automatically in your GitHub Action, but for this tutorial, we'll define it statically to keep the focus on the pipeline.
{
"version": "2.4.0",
"date": "2023-10-24",
"changes": [
{ "description": "Added dark mode support", "author": "Sarah J." },
{ "description": "Improved CLI performance", "author": "Mike T." }
],
"fixes": [
{ "description": "Resolved issue with YAML parsing" }
]
}
Create .github/workflows/release-notes.yml. This workflow triggers on a tag push and runs the Texkit CLI to compile the template.
name: Generate Release Notes
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Texkit
run: npm install -g texkit
- name: Compile Notes
run: texkit run --input release-data.json --template release-notes.txk --output release-notes.md
Often, you need the same data in different formats. Texkit's pipeline model makes this easy. You can add a second render step to output HTML for your email newsletter.
name: Compile Notes
run: |
texkit run --input release-data.json --template release-notes.txk --output release-notes.md
texkit run --input release-data.json --template release-notes.txk --output release-notes.html --format html
The HTML output will include the Markdown content wrapped in standard HTML5 boilerplate, ready to be sent via your email service.
Before committing your workflow, test it locally to ensure your template syntax is correct and the data binding works as expected.
The --dry flag will render the output to your terminal without saving it to disk, allowing you to verify the formatting immediately.
Always check if your arrays are empty before looping in your template to avoid rendering empty bullet points.
Ensure your version tags match the regex in your GitHub Action trigger (e.g., v*.*.*) to prevent accidental runs.
Never hardcode API keys or tokens. Use GitHub Secrets for any external integrations required by your pipeline.
By integrating Texkit into your GitHub Actions workflow, you eliminate the manual drudgery of writing release notes. You gain a single source of truth for your changelog and the ability to generate multiple formats from a single template.