Get Started

How to get started with Relno by adding it to an existing project.

Prerequisites

Change your repository default pull request title format. You can find it in Settings -> General -> Pull Requests on GitHub repository page.

repository setting

Relno use pull request title to generate release note. So you need to change your repository default pull request title format and make sure your pull request title follow Conventional Commits.

Setup config file

Create a relno.config.js file in your project root directory.

JavaScript
module.exports = {    template: "template.rntmd",    prTypes: [        {        identifier: "breaking",        title: "โš ๏ธ Breaking Changes",        filter: (_, commit) =>            commit.message.match(/([^()\n!]+)(?:\(.*\))?!: .+ \(#[1-9][0-9]*\)/) !==            null,        },        { identifier: "feat", title: "๐Ÿš€ Enhancements" },        { identifier: "fix", title: "๐Ÿฉน Fixes" },        { identifier: "docs", title: "๐Ÿ“– Documentation" },        { identifier: "chore", title: "๐Ÿก Chore" },        { identifier: "refactor", title: "๐Ÿ’… Refactors" },        { identifier: "test", title: "โœ… Tests" },    ],};

template is the template file path. We will use this file to generate the release note. prTypes is the pull request type configuration. identifier is the pull request type identifier. title is the pull request type title which would be generated. According above config, if you have a pull request with title feat: add new feature, the generated title would be ๐Ÿš€ Enhancements

Then, create a template.rntmd file in your project root directory.

Markdown
## ๐Ÿ“ Changelog[compare changes]({{ compareUrl }})<!-- BEGIN breaking SECTION -->### {{ title }}<!-- BEGIN commits SECTION -->- {{ prSubtype }}{{ generateIfNotEmpty(prSubtype, ": ") }}{{ toSentence(message) }} (#{{ prNumber }})<!-- END commits SECTION --><!-- END breaking SECTION --><!-- BEGIN feat, fix, docs, chore, refactor, test SECTION -->### {{ title }}<!-- BEGIN commits SECTION -->- {{ prSubtype }}{{ generateIfNotEmpty(prSubtype, ": ") }}{{ generateIf(prBreaking, "โš ๏ธ ") }}{{ toSentence(message) }} (#{{ prNumber }})<!-- END commits SECTION --><!-- END feat, fix, docs, chore, refactor, test SECTION --><!-- Generate by Release Note -->

You might notice that there are some special syntax in the template file. {{ }} is the expression syntax. Relno would replace it with the specified variable or macro, even a string literal. <!-- BEGIN commits SECTION --> and <!-- END commits SECTION --> is the section syntax. Relno need this to know where the content should be inserted.

Install Relno

Now, you can add Relno to your release workflow, or just run it as a command line tool.

GitHub Action

YAML
name: Releaseon:    release:    types: [published, edited]jobs:    release-note:    runs-on: ubuntu-latest    steps:    - uses: actions/checkout@v3        with:        fetch-depth: 0    - uses: ppodds/relno-action@v1        with:        token: ${{ secrets.GITHUB_TOKEN }}

Create a new release, and you will get your beautiful release note. ๐Ÿš€

Command Line Tool

You can install Relno globally or as a dev dependency.

BASH
npm install -g relno-cli

After installation, you can run relno-cli in your project root directory.

BASH
npx relno-cli --help

A few examples is listed below.

BASH
npx relno-cli -f v0.0.1 -t v1.0.0 -m compareUrl=https://github.com/ppodds/relno/compare/v0.0.1...v1.0.0npx relno-cli -f 5351949a32bebff9562ce5ba9078360b8fe38711 -t d467be3275eaca3639a1b6825b705cfc83fe072d