diff --git a/content/posts/automated-changelogs-gitlab.md b/content/posts/automated-changelogs-gitlab.md index 9ddae34..02b97fb 100644 --- a/content/posts/automated-changelogs-gitlab.md +++ b/content/posts/automated-changelogs-gitlab.md @@ -2,9 +2,10 @@ title: "Automated Changelogs Gitlab" date: 2023-05-15T22:38:55-03:00 draft: false +summary: "Changelog automation on GitLab CI" --- -Changelogs are good, mainly if you need to keep track of what was changed on a release. But they can be a pain to write, especially if you have a lot of commits, people working on the same project, lots of tasks, and so on. A good spot to put some **automation** here. +Changelogs are good, mainly if you need to keep track of what was changed on a release. But they can be a pain to write, especially if you have a lot of commits, people working on the same project, lots of tasks, and so on. A good spot to put some **automation**. There are a couple of ways we could make an automated changelog system, we will focus on making one that uses GitLab CI and the commit messages from the project. We will also take into consideration that *releases are made through git tags*. @@ -19,7 +20,7 @@ We will take advantage of these two commands: ## Creating a basic pipeline -Let's start by creating a basic pipeline that will run on the production release. We will use the `only` keyword to make sure it will only run on the production release. +Let's start by creating a basic pipeline that will run on the production release. ```yaml run: @@ -53,7 +54,7 @@ We will output the changelog into a file named `changelog.txt` and then we will ## Generating the changelog -Note that we set the image to be `python:latest` on the `.generateChangelog` job, this is because we will use a Python script to generate the changelog. On the code we will set two functions: one that will return the latest tag, and another that will get the commits between the latest tag and the HEAD. +Note that we set the image to be `python:latest` on the `.generateChangelog` job, this is because we will use a Python script to generate the changelog. Inside the code we will set two functions: one that will return the latest tag, and another that will get the commits between the latest tag and the HEAD. To call commands on the OS we will use the `subprocess` module, and to get the output from the command we will use the `communicate()` function. In case of an error, we can further add some error handling (more on this later).