Changie - Automated Changelog Generation for Large Projects
Tags: showdev, news, go, devops
Published: 2022-03-26 21:05:51

---
title: Changie - Automated Changelog Generation for Large Projects
published: true
description: A look at using changie for prerelease builds
tags: showdev, news, go, devops
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ucqphytxbyu5own5gz8c.png
series: Changie
---

## Preleases

When working on large projects or projects that require a few extra checks before being considered stable it is common to have prerelease builds. They go by many names but most importantly they use [semver's prerelease field to define them](https://semver.org/#spec-item-9).

It is still important to share notes on the differences in each prerelease build to communicate what has changed but what do you do when the time comes for the final release?

A common method for this is to create prerelease notes for each build as they are made. Then, when the final version is ready, package all the prerelease changes into one final release. This is because the prerelease builds were really only for testing and once the final version is ready we just want to document what is in the new version.

Changie supports this workflow by moving change fragments to a separate directory when batching new versions. And then when the final version is ready, including that separate directory or directories.

Here is an example workflow. Lets say your project is preparing for a big upgrade in v1.5.0. This release brings a lot of nice features while maintaining backwards compatibility so you want to release a series of release candidates before the final one.

```sh
# add features for next release
changie new
# batch our features for this release candidate
changie batch minor --prerelease rc1 --move-dir v1.5
# optionally merge to your CHANGELOG.md if desired
changie merge
# repeat the above for as many candidates as your project needs
# then when the final is ready
changie batch minor --include v1.5 --remove-prereleases
# include remove-prereleases to remove the v1.5.0-rcX versions already released
changie merge
```

Options are available if you choose to keep prereleases around, move each prerelease into a new directory each or if you prefer to just chain releases you can use `--keep` with each build.

[Changie batch docs](https://changie.dev/cli/changie_batch/) will have all the information you need.

## Metadata

In addition to prereleases semver supports [build metadata](https://semver.org/#spec-item-10) to be included with your versions. This can be used for pretty much anything but a few examples are; operating system, date, time, git hash or any combination.

You can easily include build metadata by adding `-m or --metadata` to batch.

A small example would be to include the current date and time as well as the first 12 characters of the git hash with each release. 

```sh
$ changie next minor \
    -m $(date +%Y%m%d) \
    -m $(git rev-parse --short=12 HEAD)
v1.7.0+20220326.4f48261c620e
```

[Changie next](https://changie.dev/cli/changie_next/) will just output what the next version would be, it takes similar parameters as batch.

That is all for now. Reach me on twitter [@miniScruffDev](https://twitter.com/miniScruffDev) or by starting a [discussion on GitHub](https://github.com/miniscruff/changie/discussions).