semantic-release / commit-analyzer

:bulb: semantic-release plugin to analyze commits with conventional-changelog
MIT License
357 stars 73 forks source link

conventional-changelog-conventionalcommits support? #130

Closed calvinl closed 4 years ago

calvinl commented 5 years ago

It seems that package isn't supported, but is available at https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits

When using conventionalcommits as the preset option, I run into the problem below, where it stops execution early at the last step below.

[1:26:48 PM] [semantic-release] › ℹ  Running semantic-release version 15.13.18
[1:26:48 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[1:26:48 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
[1:26:48 PM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[1:26:48 PM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[1:26:48 PM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[1:26:48 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
[1:26:48 PM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
[1:26:48 PM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[1:26:48 PM] [semantic-release] › ⚠  Run automated release from branch feature/semantic-release in dry-run mode
[1:26:50 PM] [semantic-release] › ✔  Allowed to push to the Git repository
[1:26:50 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/changelog"
[1:26:50 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/changelog"
[1:26:50 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
[1:26:50 PM] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication
[1:26:50 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/github"
[1:26:51 PM] [semantic-release] › ℹ  Found git tag v0.4.1 associated with version 0.4.1
[1:26:51 PM] [semantic-release] › ℹ  Found 10 commits since last release
[1:26:51 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"

It seems that if loadedConfig in load-parser-config is a function, it attempts to promisify the function. However, it looks like the config being returned here is already a Promise: https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-conventionalcommits/index.js

semantic-release-bot commented 4 years ago

:tada: This issue has been resolved in version 6.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

qlonik commented 4 years ago

Is it possible to release this patch in 7.0.0-beta and in beta of semantic-release main cli?

semantic-release-bot commented 4 years ago

:tada: This issue has been resolved in version 7.0.0-beta.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

amannn commented 4 years ago

@pvdlg Is it possible to use the recommended bump from conventional commits?

What I'm trying to do is to treat a commit message such as "fix!: This fix contains a breaking change" as breaking. From the spec:

  1. BREAKING CHANGE: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in semantic versioning). A BREAKING CHANGE can be part of commits of any type.

I couldn't get this to work, neither with the latest stable version as well as ^7.0.0-beta.4. It seems like they have a special API that needs to be used to apply the "recommended bump":

https://github.com/conventional-changelog/conventional-changelog/blob/dc8aedae0519045bfcb2e649167f0f6bfb2f4a30/packages/conventional-changelog-conventionalcommits/conventional-recommended-bump.js#L10

Could you help me with this? Thanks!

There's also this package: https://github.com/conventional-changelog/conventional-changelog/tree/3d0a52036a82ee11415ca777c005d84fa4169d2f/packages/conventional-recommended-bump. I'm not sure if it that should be used somehow?

I've also found this comment: https://github.com/semantic-release/commit-analyzer-v2/issues/11#issuecomment-270293692. Since the syntax is mentioned in the spec, shouldn't it be possible to use this out of the box?

amannn commented 4 years ago

A workaround is using this config:

    [
      '@semantic-release/commit-analyzer',
      {
        parserOpts: {
          headerPattern: /^(\w*!?)(?:\(([\w\$\.\-\* ]*)\))?\: (.*)$/
        },
        releaseRules: [
          {type: 'fix', release: 'patch'},
          {type: 'feat', release: 'minor'},
          {type: 'fix!', release: 'major'},
          {type: 'feat!', release: 'major'}
        ]
      }
    ]

However if you do that, the commits won't be picked up by the changelog plugin properly anymore.

pvdlg commented 4 years ago

Have you try using the conventionalcommits preset?

pvdlg commented 4 years ago

Nervermind. That's actually a bug: https://github.com/semantic-release/commit-analyzer/issues/153

I'll fix it ASAP.

amannn commented 4 years ago

@pvdlg Thank you so much for your help!