This provides utility functions for working with semantic versions numbers. Please see semantic versioning to understand what is going on here.
This repository requires you to use Nix Flakes. You need to include it as Nix Flake input to get access to the library. Afterwards you can just use the provided functions.
inputs = {
nixsemver = "gitlab:cynerd/nixsemver";
};
outputs = {
nixsemver,
...
}: let
inherit (nixsemver.lib) version changelog;The core functions provided by this repository.
Validate given string that it matches valid semantic version.
Split string with semantic version to attribute set with fields:
majorwith major version numberminorwith minor version numberpatchwith patch version numberpreReleasewith pre-release stringbuildwith build identifier string
Reverse operation for the semverSplit.
This is convenient addition to also extract versions from CHANGELOG.md file
that is maintained according to the Keep a
Changelog.
Returns list of releases that are recorded in the changelog file on provided path.
Returns the latest release and thus it skips Unreleased and instead provides
the one right after it. The default is 0.0.0 if there is no release yet.
Note that this relies on the ordering in the changelog and thus it won't look for actually semantically newest version.
Combination of changelog.releases and changelog.latestRelease and thus it
provides latest release from changelog file on provided path.