Repost changelogs to your static website
Releasepost retrieves release notes from GitHub, GitLab, or a Gitea compatible forge such as Forgejo or Codeberg. It can generate json, markdown, and asciidoctor files.
By default, releasepost creates one file per release note, plus one additional index file.
It can also collect every release note into a single file such as CHANGELOG.md (see Single changelog file).
releasepost relies on a configuration file to identify what release to monitor and where to repost it. The configuration file uses the YAML format and accepts the following parameters:
namedefines the changelog name to monitor. It is used to identify a changelog configuration among differentts ones.dirdefines the directory where to mirror the release notekinddefines the kind of changelog to mirror:github(default),gitlab, orgiteaformatsdefines a list of format parameters for the mirrored changelog.specdefines specific parameters to a kind of mirror.
The following example can be used for a HUGO website
Command
export GITHUB_TOKEN=<insert read-only token>
releasepost --config .releaserepost.yaml
Configuration
.releaserepost.yaml
changelogs:
- kind: github
dir: content/en/docs/changelogs/updatecli
formats:
- extension: asciidoc
indexfilename: _index
- extension: json
indexfilename: _index
spec:
owner: updatecli
repository: udash
Each entry of formats accepts the following parameters:
extensiondefines the file format:markdown(default),asciidoc, orjson.layoutdefines which files are generated:release(default): one file per release in<dir>/changelogs/, plus an index file.changelog: a single file in<dir>with every release, newest first. No per-release file is generated.
indexfilenamedefines the index file name without extension. Defaultindex, orCHANGELOGwith thechangeloglayout.filetemplateandindexfiletemplateoverride the default Go templates. Sprig functions are available.frontmattersandindexfrontmattersdefine front matters added to the generated files.
The changelog layout generates a single CHANGELOG.md from your published releases:
changelogs:
- kind: github
dir: .
formats:
- extension: markdown
layout: changelog
spec:
owner: updatecli
repository: releasepost
This generates ./CHANGELOG.md:
# Changelog
## [v0.2.0](https://github.com/updatecli/releasepost/releases/tag/v0.2.0) - 2024-02-01
<release note>
## [v0.1.0](https://github.com/updatecli/releasepost/releases/tag/v0.1.0) - 2024-01-01
<release note>
With extension: asciidoc it generates CHANGELOG.adoc, and with extension: json a CHANGELOG.json that contains every release.
--clean only removes untracked files from the <dir>/changelogs directory of each configured changelog, and never from a directory used as a dir, so you can use it with dir: ..
GitHub integration requires a read-only personal access token. The token must have enough permission to read release information.
changelogs:
- kind: github
spec:
# Define the GitHub owner
owner: updatecli
# Define the GitHub repository
repository: updatecli
# Define the release type to retrieve
typefilter:
draft: false
prerelease: false
release: true
latest: true
# Define the GitHub url
url: https://github.com
# Define the token used to authenticate
token: xxx
The following environment variables will be used as a fallback
GITHUB_REPOSITORYused to set owner and repositoryGITHUB_TOKENused to set the tokenGITHUB_URLused to set the GitHub url
A token isn't needed to read the releases of a public project.
For a private project, use a personal, project, or group access token with the read_api scope.
changelogs:
- kind: gitlab
spec:
# Define the GitLab user, group, or subgroup owning the project
owner: gitlab-org
# Define the GitLab project
repository: gitlab-runner
# Define the release type to retrieve
# GitLab has no draft release, and an upcoming release is a pre-release
typefilter:
prerelease: false
release: true
latest: false
# Define the GitLab url, for a self-managed instance
url: https://gitlab.com
# Define the token used to authenticate
token: xxx
The following environment variables will be used as a fallback
GITLAB_TOKENused to set the tokenCI_SERVER_URLused to set the GitLab urlCI_PROJECT_PATHused to set owner and repository, when both are empty
The latest release is the newest release that isn't upcoming.
The gitea kind works with any Gitea compatible forge, such as Gitea, Forgejo, or Codeberg.
A token isn't needed to read the releases of a public repository.
For a private repository, use an access token with the read:repository scope.
changelogs:
- kind: gitea
spec:
# Define the url of the forge
url: https://codeberg.org
# Define the owner
owner: forgejo
# Define the repository
repository: forgejo
# Define the release type to retrieve
typefilter:
draft: false
prerelease: false
release: true
latest: false
# Define the token used to authenticate
token: xxx
The following environment variables will be used as a fallback
GITEA_TOKENused to set the tokenGITEA_URLused to set the forge url
The latest release is the newest release that is neither a draft nor a pre-release.
Releasepost is designed to work with Updatecli where releasepost is responsible to generate the correct files based on third changelogs and Updatecli to automate the process of publishing them to a git repository.
It can be used with one of the two Updatecli policy:
Used by the Updatecli project to publish all release notes on updatecli.io
Used by the Rancher Fleet project to publish all release note associated to a MAJOR.MINOR version - rancher.fleet.io
This project already solves our initial problem which was to republish Updatecli changelogs from GitHub release to a static website. That being said, it was also built with extensibility in mind so we could monitor other sources than GitHub releases.
As a community-oriented project, all contributions are greatly appreciated!
Here is a non-exhaustive list of possible contributions:
- ⭐️ this repository.
- Propose a new feature request.
- Highlight an existing feature request with 👍.
- Contribute to any repository in the updatecli organization
- Share the love
Can releasepost generate changelog?
Releasepost can collect release notes that are already published, for example on GitHub, into a single CHANGELOG.md (see Single changelog file).
To write the release notes in the first place, use one of these tools:
-
Release Drafter can automatically generate the next changelogs based on pullrequest labels. If the generated changelog is wrong, you can still update labels on already merged pullrequest and then retrigger release drafter to update the the generated changelog.
-
Conventional Changelog can automatically generate the next changelogs based on commit following conventional commit. If the generated changelog is wrong, you can still modify your git history...
-
Changie is another great tool to generate changelog
The purpose of releasepost is to retrieve already published changelogs and to republish them, for example on a project website.
Why using _index instead of index on HUGO project?