Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate note with custom sections? #153

Closed
max10rogerio opened this issue Nov 18, 2019 · 9 comments
Closed

How to generate note with custom sections? #153

max10rogerio opened this issue Nov 18, 2019 · 9 comments
Labels

Comments

@max10rogerio
Copy link

Hi, i'm trying generate release notes with custom sections, but my configuration isn't working...
I read the issues:

I don't know which setting to use

My .releaserc.json file:

{
  "branch": "master",
  "plugins": [
    [
      "@semantic-release/commit-analyzer",
      {
        "releaseRules": [
          {
            "type": "refactor",
            "release": "patch"
          },
          {
            "type": "docs",
            "release": "patch"
          },
          {
            "type": "test",
            "release": "patch"
          },
          {
            "type": "style",
            "release": "patch"
          },
          {
            "type": "perf",
            "release": "patch"
          },
          {
            "type": "build",
            "release": "patch"
          }
        ]
      }
    ],
    [
      "@semantic-release/release-notes-generator",
      {
        "writerOpts": {
          "types": [
            {
              "type": "feat",
              "section": ":sparkles: Novidades",
              "hidden": false
            },
            {
              "type": "fix",
              "section": ":bug: Correções",
              "hidden": false
            },
            {
              "type": "docs",
              "section": ":memo: Documentação",
              "hidden": false
            },
            {
              "type": "style",
              "section": ":barber: Estilização",
              "hidden": false
            },
            {
              "type": "refactor",
              "section": ":zap: Refatoração",
              "hidden": false
            },
            {
              "type": "perf",
              "section": ":fast_forward: Refatoração",
              "hidden": false
            },
            {
              "type": "test",
              "section": ":white_check_mark: Testes",
              "hidden": false
            },
            {
              "type": "chore",
              "hidden": true
            }
          ]
        }
      }
    ],
    [
      "@semantic-release/changelog",
      {
        "changelogFile": "CHANGELOG.md",
        "changelogTitle": "Notas de versão"
      }
    ],
    [
      "@semantic-release/git",
      {
        "assets": [
          "CHANGELOG.md"
        ],
        "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
      }
    ],
    [
      "@semantic-release/github",
      {
        "assets": [
          {
            "path": "server.zip",
            "label": "DeltaWeb - Build: ${nextRelease.gitTag}",
            "name": "server-${nextRelease.gitTag}.zip"
          }
        ]
      }
    ]
  ]
}
@pvdlg
Copy link
Member

pvdlg commented Nov 18, 2019

The default preset is angular and I don't think it uses the types property.
Maybe you meant to use another preset that support this property?

@max10rogerio
Copy link
Author

max10rogerio commented Nov 18, 2019

Sorry, the first time I tried using presetConfig, but it wasn't working ...

Any ideia of how change the title of section commits using preset angular?

@pvdlg
Copy link
Member

pvdlg commented Nov 18, 2019

I don't think the angular preset support any option. You will have to rewrite the transform function: https://github.com/conventional-changelog/conventional-changelog/blob/79217815a7ce5f3d3f833961ce9a14bd454e5789/packages/conventional-changelog-angular/writer-opts.js#L27

@pvdlg
Copy link
Member

pvdlg commented Nov 18, 2019

Maybe you were trying to use the conventionalcommits preset that seems to support the option you are trying to use: https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-conventionalcommits/writer-opts.js#L160

@pvdlg pvdlg added the support label Nov 18, 2019
@max10rogerio
Copy link
Author

Thanks!!!

After opened the PR, I read again the last note

Note: For presets that expects a configuration object, such as conventionalcommits, the presetConfig option must be set.

I changed the .releaserc.json and...

image

I needed to install the package: conventional-changelog-conventionalcommits and updated for:

{
  "branch": "master",
  "plugins": [
    [
      "@semantic-release/commit-analyzer",
      {
        "releaseRules": [
          {
            "type": "refactor",
            "release": "patch"
          },
          {
            "type": "docs",
            "release": "patch"
          },
          {
            "type": "test",
            "release": "patch"
          },
          {
            "type": "style",
            "release": "patch"
          },
          {
            "type": "perf",
            "release": "patch"
          },
          {
            "type": "ci",
            "release": "patch"
          },
          {
            "type": "build",
            "release": "patch"
          }
        ]
      }
    ],
    [
      "@semantic-release/release-notes-generator",
      {
        "preset": "conventionalcommits",
        "presetConfig": {
          "types": [
            {
              "type": "feat",
              "section": ":sparkles: Novidades",
              "hidden": false
            },
            {
              "type": "fix",
              "section": ":bug: Correções",
              "hidden": false
            },
            {
              "type": "docs",
              "section": ":memo: Documentação",
              "hidden": false
            },
            {
              "type": "style",
              "section": ":barber: Estilização",
              "hidden": false
            },
            {
              "type": "refactor",
              "section": ":zap: Refatoração",
              "hidden": false
            },
            {
              "type": "perf",
              "section": ":fast_forward: Desempenho",
              "hidden": false
            },
            {
              "type": "test",
              "section": ":white_check_mark: Testes",
              "hidden": false
            },
            {
              "type": "ci",
              "section": ":repeat: CI",
              "hidden": false
            },
            {
              "type": "chore",
              "hidden": true
            }
          ]
        }
      }
    ],
    [
      "@semantic-release/github",
      {
        "assets": [
          {
            "path": "server.zip",
            "label": "DeltaWeb - Build: ${nextRelease.gitTag}",
            "name": "server-${nextRelease.gitTag}.zip"
          }
        ]
      }
    ]
  ]
}

@tomavic
Copy link

tomavic commented Feb 5, 2023

This solution should be highlighted in the documentation as many issues refers to it.

@TheNotary
Copy link

TheNotary commented Mar 8, 2023

True, but if you felt ignored about your opinions towards commit messages you might fare the same unwillingness to help after a long day of trying to get something working that you'd expect to have been fast and simple.

Btw, don't forget to run the below command or you'll get errors about removing the presets from the built-in libs.

npm install --save conventional-changelog

@tomavic
Copy link

tomavic commented Aug 21, 2023

Does anyone got any idea?
Still needs more explanation!

beiertu-mms added a commit to MediaMarktSaturn/technolinator that referenced this issue Sep 21, 2023
Define all possible commit types and their corresponding releases.
And add the conventional commits preset in release-note-generator
plugin, so that a more useful release note can be generated.

See also:
- https://github.com/semantic-release/commit-analyzer#rules-definition
- semantic-release/release-notes-generator#153 (comment)
beiertu-mms added a commit to MediaMarktSaturn/technolinator that referenced this issue Sep 21, 2023
Define all possible commit types and their corresponding releases.
And add the conventional commits preset in release-note-generator
plugin, so that a more useful release note can be generated.

See also:
- https://github.com/semantic-release/commit-analyzer#rules-definition
- semantic-release/release-notes-generator#153 (comment)
@mdrijwan
Copy link

@max10rogerio thanks man! this is brilliant!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants