Home

Awesome

CircleCI codecov

Gitlab Release Note Generator

A Gitlab release note generator that generates release note on latest tag

Feature

How it works

  1. Find the latest tag
  2. Find the previous tag that is on the same branch as the latest tag.
  3. Locate the date range between the latest and the previous tag. If there is only a tag in the project, then the from date will be the project creation date and the to date will be that tag's creation date.
  4. Find all Merged merge requests and Closed issues within that time range
  5. Generate a release note/changelog based on the findings above.

Software requirement

How to run this app

Docker method

docker container run -e GITLAB_PERSONAL_TOKEN=gitlabSampleToken -e GITLAB_PROJECT_ID=12345678 -e TARGET_BRANCH=sampleTargetBranch -e TARGET_TAG_REGEX=sampleRegex 00freezy00/gitlab-release-note-generator

Nodejs Method

Gitlab CI method

  1. Need to pass in gitlab personal access token as a CI variable

  2. c/p the .sample.gitlab-ci.yml to your gitlab ci.

    What's included in the sample gitlab CI script

    • generate-release-note job. Generates a release note on the tag after detecting tag push with this regex /^[0-9]+.[0-9]+.[0-9]+(-[0-9]+)?$/
    • tag-after-deployment job (optional). Tag the commit that contains a version bump with this regex /^[0-9]+.[0-9]+.[0-9]+(-[0-9]+)?$/. Require ssh key to work.
  3. Customise the gitlab ci script to your need

Reference gitlab repo: generator test

Options

These can be specified using environment variables

Building and Running locally

export GITLAB_PERSONAL_TOKEN=MYGITLABACCESSTOKEN
export GITLAB_PROJECT_ID=99
export GITLAB_API_ENDPOINT=https://my.gitlab.com/api/v4

// run docker to build my local version
docker build -t local-gitlab-release-note-generator .

// run my local version
docker container run \
  -e TZ=America/New_York \
  -e GITLAB_API_ENDPOINT=$GITLAB_API_ENDPOINT \
  -e GITLAB_PERSONAL_TOKEN=$GITLAB_PERSONAL_TOKEN \
  -e GITLAB_PROJECT_ID=$GITLAB_PROJECT_ID \
  -e TARGET_BRANCH=master \
  -e TARGET_TAG_REGEX=^release-.*$ \
  local-gitlab-release-note-generator

TODO:

Feature

Credits

Thanks to github-changelog-generator for inspiring me to make this app. Sorry, I couldn't wait any longer for that gitlab feature to be merged in.