Skip to content

About

Re-post release notes

Resources

Code of conduct

Stars

5 stars

Watchers

2 watching

Forks

Repository files navigation

releasepost

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).

Config

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:

Changelogs

  • name defines the changelog name to monitor. It is used to identify a changelog configuration among differentts ones.
  • dir defines the directory where to mirror the release note
  • kind defines the kind of changelog to mirror: github (default), gitlab, or gitea
  • formats defines a list of format parameters for the mirrored changelog.
  • spec defines 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

Formats

Each entry of formats accepts the following parameters:

  • extension defines the file format: markdown (default), asciidoc, or json.
  • layout defines 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.
  • indexfilename defines the index file name without extension. Default index, or CHANGELOG with the changelog layout.
  • filetemplate and indexfiletemplate override the default Go templates. Sprig functions are available.
  • frontmatters and indexfrontmatters define front matters added to the generated files.

Single changelog file

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

Credentials

GitHub integration requires a read-only personal access token. The token must have enough permission to read release information.

Configuration

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_REPOSITORY used to set owner and repository
  • GITHUB_TOKEN used to set the token
  • GITHUB_URL used to set the GitHub url

GitLab

Credentials

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.

Configuration

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_TOKEN used to set the token
  • CI_SERVER_URL used to set the GitLab url
  • CI_PROJECT_PATH used to set owner and repository, when both are empty

The latest release is the newest release that isn't upcoming.

Gitea

The gitea kind works with any Gitea compatible forge, such as Gitea, Forgejo, or Codeberg.

Credentials

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.

Configuration

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_TOKEN used to set the token
  • GITEA_URL used to set the forge url

The latest release is the newest release that is neither a draft nor a pre-release.

Integration

Updatecli

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:

HUGO

Used by the Updatecli project to publish all release notes on updatecli.io

Docusaurus - rancher.fleet.io

Used by the Rancher Fleet project to publish all release note associated to a MAJOR.MINOR version - rancher.fleet.io

Contributing

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

FAQ

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?

The difference between index.md and _index.md

About

Re-post release notes

Resources

Code of conduct

Stars

5 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages