How to make semantic-release do a release on a docs commit?

917 views Asked by At

I started using semantic-release for some projects I have, is there a way to "force" a patch release on a docs: commit?

Why on docs? Because it publishes on npm too and I want to have the latest documentation there.


I also use dependabot to keep my dependencies up to date, should have patch releases for updated dependencies too, since a fix in a dependency is a potential fix in my project too.

1

There are 1 answers

2
Manu Artero On

the plugin in charge of deciding if your changes should trigger a release is "@semantic-release/commit-analyzer" (no need to install it specifically), all you need to config is the "releaseRules" value:

  "release": {
    "branches": [
      "main"
    ],
    "plugins": [
      [
        "@semantic-release/commit-analyzer",
        {
          "preset": "angular",
          "releaseRules": [
            {
              "type": "docs",
              "release": "patch"
            }
          ]
        }
      ],
      "@semantic-release/release-notes-generator",
      "@semantic-release/changelog",
      "@semantic-release/npm",
      "@semantic-release/git",
      ...
    ]
  },