semantic-release / release-notes-generator

:clipboard: semantic-release plugin to generate changelog content with conventional-changelog
MIT License
317 stars 47 forks source link

I need to include other commits than `feat` and `fix`. #403

Open tomavic opened 1 year ago

tomavic commented 1 year ago

Hi Help wanted πŸ†˜

I have a react app configured with GithubPages. I need to include commits like chore, style, refactor ..etc in the generated CHANGELOG.

This is my config .releaserc.json

{
  "branches": [
    { "name": "main" },
    { "name": "pre/rc", "channel": "pre/rc", "prerelease": "rc" },
    { "name": "beta", "channel": "beta", "prerelease": true }
  ],
  "plugins": [
    [
      "@semantic-release/commit-analyzer",
      {
        "preset": "angular",
        "releaseRules": [
          { "type": "docs", "release": "patch" },
          { "type": "refactor", "release": "patch" },
          { "type": "style", "release": "patch" },
          { "type": "ci", "release": "patch" },
          { "type": "chore", "release": "patch" }
        ]
      }
    ],
    [
      "@semantic-release/release-notes-generator",
      {
        "parserOpts": {
          "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
        },
        "preset": "conventionalcommits", // I used angular preset and failed too 
        "presetConfig": {
          "types": [
            {
              "type": "breaking",
              "section": "❗ Breaking ❗",
              "hidden": false
            },
            { "type": "feat", "section": "✨ Feature ✨", "hidden": false },
            { "type": "fix", "section": "πŸ› Bugfix πŸ›", "hidden": false },
            { "type": "hotfix", "section": "πŸ”₯ Hotfix πŸ”₯", "hidden": false },
            {
              "type": "BREAKING",
              "section": "❗ Breaking ❗",
              "hidden": false
            },
            { "type": "HOTFIX", "section": "πŸ”₯ Hotfix πŸ”₯", "hidden": false }
          ]
        }
      }
    ],
    [
      "@semantic-release/changelog",
      {
        "changelogFile": "CHANGELOG.md"
      }
    ],
    [
      "@semantic-release/git",
      {
        "assets": ["CHANGELOG.md"],
        "message": "build: πŸš€ ${nextRelease.gitTag} has been released \n\n${nextRelease.notes}"
      }
    ],
    [
      "@semantic-release/github",
      {
        "assets": ["dist/assets/**"]
      }
    ]
  ]
}

and this is the generated CHANGELOG.md

# 1.0.0 (2022-12-29)

### Features

- :sparkles: add 404 not found page ([3c862d3](https://github.com/tomavic/myreads-tracker/commit/3c862d39c7723715b2397908ab63b7d154d1daf6))
- :sparkles: add book details page ([556caca](https://github.com/tomavic/myreads-tracker/commit/556caca2e4086330cc9c2fe95fa94db3f1871491))
- :sparkles: add project files ([7805ac1](https://github.com/tomavic/myreads-tracker/commit/7805ac18bf1eee3da4549fb935cf2c943c217a86))
- :sparkles: first commit ([1a4b6f3](https://github.com/tomavic/myreads-tracker/commit/1a4b6f3b0fc33c94f78598aa3558daf2b4b06516))
- :sparkles: style and favicon ([9501b1c](https://github.com/tomavic/myreads-tracker/commit/9501b1c7f0a19814129c8f73952d475bc377d3c6))
- :sparkles: use `useRoutes` ([adbd18f](https://github.com/tomavic/myreads-tracker/commit/adbd18f34e13f18c72388474e42af20541cb1ab5))
CynanX commented 1 year ago

Do you not just need to add β€˜chore’ into your release-generator types?

{"type": "chore", "hidden": true},

tomavic commented 1 year ago

I already did that, please check the demo project

https://github.com/tomavic/myreads-tracker/blob/main/CHANGELOG.md

tomavic commented 1 year ago

I found the solution after many searches here https://github.com/semantic-release/release-notes-generator/issues/153

My searches has fall to https://github.com/mathieudutour/github-tag-action/issues/68 and I noticed that I must remove the default preset Angular and add "preset": "conventionalcommits", and install the conventional-changelog-conventionalcommits from here https://www.npmjs.com/package/conventional-changelog-conventionalcommits

This part is not clear in the documentation