4 minute read

Here you can find the example of a medium complexity configuration in the supported formats.

This configuration doesn’t use any preset but sets many global configuration options explicitly along with commit message conventions and release types. Where allowed, templates are also used.

Configuration options using templates may not be rendered correctly in this page so please refer to the links to source code provided for each file.

JSON

{
  "changelog": {
    "path": "CHANGELOG.md",
    "sections": {
      "Added": "^feat$",
      "Fixed": "^fix$"
    },
    "substitutions": {
      "(?m)#([0-9]+)(?s)": "[#%s](https://example.com/issues/%s)"
    }
  },
  "commitMessageConventions": {
    "enabled": [
      "conventionalCommits"
    ],
    "items": {
      "conventionalCommits": {
        "expression": "(?m)^(?<type>[a-zA-Z0-9_]+)(\\((?<scope>[a-z ]+)\\))?(!)?:( (?<title>.+))$(?s).*",
        "bumpExpressions": {
          "major": "(?s)(?m)^[a-zA-Z0-9_]+(\\([a-z ]+\\))?(!: .*|.*^(BREAKING( |-)CHANGE: )).*",
          "minor": "(?s)(?m)^feat(!{0})(\\([a-z ]+\\))?: (?!.*^(BREAKING( |-)CHANGE: )).*",
          "patch": "(?s)(?m)^fix(!{0})(\\([a-z ]+\\))?: (?!.*^(BREAKING( |-)CHANGE: )).*"
        }
      }
    }
  },
  "dryRun": false,
  "git": {
    "remotes": {
      "origin": {
        "authenticationMethod": "USER_PASSWORD",
        "user": "jdoe",
        "password": "somepassword"
      }
    }
  },
  "initialVersion": "0.1.0",
  "releaseLenient": true,
  "releasePrefix": "v",
  "releaseTypes": {
    "enabled": [
      "mainline",
      "internal"
    ],
    "publicationServices": [
      "github"
    ],
    "items": {
      "mainline": {
        "collapseVersions": false,
        "filterTags": "^()?([0-9]\\d*)\\.([0-9]\\d*)\\.([0-9]\\d*)$",
        "gitCommit": "true",
        "gitCommitMessage": "Release version ",
        "gitPush": "true",
        "gitPushForce": "true",
        "gitTag": "true",
        "gitTagForce": "true",
        "gitTagMessage": "Tag release ",
        "gitTagNames": [
          "",
          "stable",
          "latest"
        ],
        "matchBranches": "^(master|main)$",
        "matchEnvironmentVariables": {
          "CI": "^true$"
        },
        "matchWorkspaceStatus": "CLEAN",
        "publish": "true",
        "releaseName": "Release ",
        "versionRangeFromBranchName": false
      },
      "internal": {
        "collapseVersions": false,
        "collapsedVersionQualifier": "internal",
        "description": "Internal release ",
        "filterTags": "^()?([0-9]\\d*)\\.([0-9]\\d*)\\.([0-9]\\d*)$",
        "gitCommit": "false",
        "gitPush": "false",
        "gitTag": "false",
        "identifiers": [
          {
            "position": "BUILD",
            "qualifier": "branch",
            "value": ""
          },
          {
            "position": "BUILD",
            "qualifier": "commit",
            "value": ""
          },
          {
            "position": "BUILD",
            "qualifier": "user",
            "value": ""
          },
          {
            "position": "BUILD",
            "qualifier": "timestamp",
            "value": ""
          }
        ],
        "publish": "false",
        "publishDraft": "true",
        "versionRangeFromBranchName": false
      }
    }
  },
  "scheme": "SEMVER",
  "services": {
    "github": {
      "type": "GITHUB",
      "options": {
        "AUTHENTICATION_TOKEN": "GITHUB_TOKEN",
        "REPOSITORY_NAME": "myrepo",
        "REPOSITORY_OWNER": "acme"
      }
    }
  },
  "substitutions": {
    "enabled": [
      "npm"
    ],
    "items": {
      "npm": {
        "files": "package.json",
        "match": "\"version\"(\\s)*:(\\s)*\"(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?\"",
        "replace": "\"version\": \"\""
      }
    }
  },
  "verbosity": "INFO"
}

Source code for this file is available here.

YAML

--- 
changelog:
  path: "CHANGELOG.md"
  sections:
    "Added": "^feat$"
    "Fixed": "^fix$"
  substitutions:
    "(?m)#([0-9]+)(?s)": "[#%s](https://example.com/issues/%s)"
commitMessageConventions: 
  enabled: 
    - conventionalCommits
  items: 
    conventionalCommits: 
      expression: "(?m)^(?<type>[a-zA-Z0-9_]+)(\\((?<scope>[a-z ]+)\\))?(!)?:( (?<title>.+))$(?s).*"
      bumpExpressions: 
        major: '(?s)(?m)^[a-zA-Z0-9_]+(\\([a-z ]+\\))?(!: .*|.*^(BREAKING( |-)CHANGE: )).*'
        minor: '(?s)(?m)^feat(!{0})(\\([a-z ]+\\))?: (?!.*^(BREAKING( |-)CHANGE: )).*'
        patch: '(?s)(?m)^fix(!{0})(\\([a-z ]+\\))?: (?!.*^(BREAKING( |-)CHANGE: )).*'
dryRun: false
git:
  remotes:
    origin:
      authenticationMethod: USER_PASSWORD
      user: jdoe
      password: somepassword
initialVersion: "0.1.0"
releaseLenient: true
releasePrefix: v
releaseTypes: 
  enabled: 
    - mainline
    - internal
  publicationServices: 
    - github
  items: 
    mainline: 
      collapseVersions: false
      filterTags: "^()?([0-9]\\d*)\\.([0-9]\\d*)\\.([0-9]\\d*)$"
      gitCommit: "true"
      gitCommitMessage: "Release version "
      gitPush: "true"
      gitPushForce: "true"
      gitTag: "true"
      gitTagForce: "true"
      gitTagMessage: "Tag release "
      gitTagNames:
        - ""
        - "stable"
        - "latest"
      matchBranches: "^(master|main)$"
      matchEnvironmentVariables: 
        CI: "^true$"
      matchWorkspaceStatus: "CLEAN"
      publish: "true"
      releaseName: "Release "
      versionRangeFromBranchName: false
    internal: 
      collapseVersions: false
      collapsedVersionQualifier: "internal"
      description: "Internal release "
      filterTags: "^()?([0-9]\\d*)\\.([0-9]\\d*)\\.([0-9]\\d*)$"
      gitCommit: "false"
      gitPush: "false"
      gitTag: "false"
      identifiers: 
        -
          position: BUILD
          qualifier: branch
          value: ""
        -
          position: BUILD
          qualifier: commit
          value: ""
        -
          position: BUILD
          qualifier: user
          value: ""
        -
          position: BUILD
          qualifier: timestamp
          value: ""
      publish: "false"
      publishDraft: "true"
      versionRangeFromBranchName: false
scheme: "SEMVER"
services: 
  github: 
    type: "GITHUB"
    options: 
      AUTHENTICATION_TOKEN: "GITHUB_TOKEN"
      REPOSITORY_NAME: "myrepo"
      REPOSITORY_OWNER: "acme"
substitutions: 
  enabled: 
    - npm
  items: 
    npm: 
      files: "package.json"
      match: "\"version\"(\\s)*:(\\s)*\"(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?\""
      replace: "\"version\": \"\""
verbosity: "INFO"

Source code for this file is available here.

Groovy (Gradle)

nyx {
  changelog {
    path = 'CHANGELOG.md'
    sections = [
      'Added' : '^feat$',
      'Fixed' : '^fix$',
    ]
    substitutions = [
      '(?m)#([0-9]+)(?s)': '[#%s](https://example.com/issues/%s)'
    ]
  }
  commitMessageConventions {
    enabled = [ 'conventionalCommits' ]
    items {
      conventionalCommits {
        expression = '(?m)^(?<type>[a-zA-Z0-9_]+)(\\\\((?<scope>[a-z ]+)\\\\))?(!)?:( (?<title>.+))$(?s).*'
        bumpExpressions {
          major = '(?s)(?m)^[a-zA-Z0-9_]+(\\([a-z ]+\\))?(!: .*|.*^(BREAKING( |-)CHANGE: )).*'
          minor = '(?s)(?m)^feat(!{0})(\\\\([a-z ]+\\\\))?: (?!.*^(BREAKING( |-)CHANGE: )).*'
          patch = '(?s)(?m)^fix(!{0})(\\\\([a-z ]+\\\\))?: (?!.*^(BREAKING( |-)CHANGE: )).*'
        }
      }
    }
  }
  dryRun = false
  git {
    remotes {
      origin {
        authenticationMethod = 'USER_PASSWORD'
        user = 'jdoe'
        password = 'somepassword'
      }
    }
  }
  initialVersion = '0.1.0'
  releaseLenient = true
  releasePrefix = 'v'
  releaseTypes {
    enabled = [ 'mainline', 'internal' ]
    publicationServices = [ 'github' ]
    items {
      mainline {
        collapseVersions = false
        filterTags = '^()?([0-9]\\d*)\\.([0-9]\\d*)\\.([0-9]\\d*)$'
        gitCommit = 'true'
        gitCommitMessage = 'Release version '
        gitPush = 'true'
        gitPushForce = 'true'
        gitTag = 'true'
        gitTagForce = 'true'
        gitTagMessage = 'Tag release '
        gitTagNames = [ '', 'stable', 'latest' ]
        matchBranches = '^(master|main)$'
        matchEnvironmentVariables {
          CI = '^true$'
        }
        matchWorkspaceStatus = 'CLEAN'
        publish = 'true'
        releaseName = 'Release '
        versionRangeFromBranchName = false
      }
      internal {
        collapseVersions = false
        collapsedVersionQualifier = 'internal'
        description = 'Internal release '
        filterTags = '^()?([0-9]\\d*)\\.([0-9]\\d*)\\.([0-9]\\d*)$'
        gitCommit = 'false'
        gitPush = 'false'
        gitTag = 'false'
        identifiers {
          '0' {
            position = 'BUILD'
            qualifier = 'branch'
            value = ''
          }
          '1' {
            position = 'BUILD'
            qualifier = 'commit'
            value = ''
          }
          '2' {
            position = 'BUILD'
            qualifier = 'timestamp'
            value = ''
          }
          '3' {
            position = 'BUILD'
            qualifier = 'user'
            value = ''
          }
        }
        publish = 'false'
        publishDraft = 'true'
        versionRangeFromBranchName = false
      }
    }
  }
  scheme = 'SEMVER'
  services {
    github {
      type = 'GITHUB'
      options {
        AUTHENTICATION_TOKEN = 'GITHUB_TOKEN'
        REPOSITORY_NAME = 'myrepo'
        REPOSITORY_OWNER = 'acme'
      }
    }
  }
  substitutions {
    enabled = [ 'npm' ]
    items {
      npm {
        files = 'package.json'
        match = '"version"(\s)*:(\s)*"(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?"'
        replace = '"version": ""'
      }
    }
  }
  verbosity = 'INFO'
}

Source code for this file is available here.