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

CHANGELOGS not generated correctly when using "--conventional-graduate" #2248

Open
kelvincy opened this issue Sep 2, 2019 · 9 comments
Open

Comments

@kelvincy
Copy link

kelvincy commented Sep 2, 2019

Expected Behavior

When versioning and publishing a prerelease version we do not want to generate the CHANGELOGS. This is done successfully with the "--no-changelog" for DTA environments.

But when we do "--conventional-graduate" for the production release to remove the "preid", we want to generate a CHANGELOG for the production version. This is what we expect in the CHANGELOG for production.

## [0.0.7](git-tags) (2019-09-02)

### Bug Fixes

- commit 1
- commit 2

Current Behavior

This is what we are currently seeing in the CHANGELOG for production.

## [0.0.7](git-tags) (2019-09-02)

**Note:** Version bump only for package @package

Possible Solution

It probably has something to do with the git-tags for the prerelease versions that are already "released" with their changes. That is why the production publish does not see the changes anymore.

Steps to Reproduce (for bugs)

For prerelease:

  1. lerna version --conventional-prerelease --no-changelog
  2. lerna publish

Then for production:

  1. lerna version --conventional-graduate
  2. lerna publish
lerna.json

{
  "packages": ["packages/*"],
  "version": "independent",
  "command": {
    "publish": {
      "conventionalCommits": true,
      "ignoreChanges": ["**/*.md"],
      "yes": true
    },
    "version": {
      "conventionalCommits": true,
      "ignoreChanges": ["**/*.md"]
    }
  },
}

Context

Your Environment

Executable Version
lerna --version 3.16.4
npm --version 10
node --version 6
@thuringia
Copy link

thuringia commented Sep 4, 2019

I can reproduce this.

This commit message is valid under the conventional commitlint config but does not yield an entry in the changelog, instead creating the "bump only" message:
build(sweepstake): transpile the styleguide
It does create when using conventional-changelog directly with the conventional preset, this doesn't work in though -> #2138

@kelvincy It does work for me when changing the type to "fix". That could be a workaround until this issue can be fixed in lerna

@kelvincy
Copy link
Author

kelvincy commented Sep 4, 2019

Hey @thuringia, I tried with the commit messages fix and feat. Both of them will not generate CHANGELOGs when performing lerna version --conventional-graduate on production.

We have found a fix for this. Not sure if this is a preferred way, but it is currently working for us:

Prereleases:

  1. lerna version --conventional-prerelease --preid dev --no-changelog
  2. git tag -d $(git describe --abbrev=0)
    (This will remove the git tags from the commit so that lerna does not think it is released already)
  3. git push
  4. lerna publish from-package

Production:

  1. lerna version --conventional-graduate
  2. lerna publish from-git

@thuringia
Copy link

Hey @thuringia, I tried with the commit messages fix and feat. Both of them will not generate CHANGELOGs when performing lerna version --conventional-graduate on production.

We have found a fix for this. Not sure if this is a preferred way, but it is currently working for us:

Prereleases:

  1. lerna version --conventional-prerelease --preid dev --no-changelog
  2. git tag -d $(git describe --abbrev=0)
    (This will remove the git tags from the commit so that lerna does not think it is released already)
  3. git push
  4. lerna publish from-package

Production:

  1. lerna version --conventional-graduate
  2. lerna publish from-git

Interesting; thanks for letting me know. I will keep this in mind in case my current strategy stops working

@davthu
Copy link

davthu commented Apr 29, 2020

Interesting; thanks for letting me know. I will keep this in mind in case my current strategy stops working

@thuringia What is your current strategy then? It's not optimal to regenerate the entire changelog on each release using the conventional-changelog-cli.

ncphillips added a commit to tinacms/tinacms that referenced this issue Jul 24, 2020
This should help keep down the clutter and make the changelog more useful

lerna/lerna#2248 (comment)
@ncphillips
Copy link

@kelvincy I just found the --no-git-tag-version flag which I think makes your process a bit easier.

Prereleases:

  1. lerna version --conventional-prerelease --preid dev --no-changelog --no-git-tag-version
  2. git tag -d $(git describe --abbrev=0)
  3. lerna publish from-package

See our build script

@morewry
Copy link

morewry commented Oct 20, 2021

I found that for 4.0.0, --no-git-tag-version skips all git interactions. No tag, no commit, no push. (--no-push appears superfluous and --push doesn't change anything about the behavior.)

Using it prevents use of lerna publish from-git with the message:

lerna notice from-git No tagged release found

One has to add steps to make a commit and then lerna publish from-package or it fails with the message:

lerna ERR! EUNCOMMIT Working tree has uncommitted changes, please commit or remove the following changes before continuing:

(This is in the above build script, but now it's in plain text.)

@Matb85
Copy link

Matb85 commented Dec 31, 2022

Has it been fixed yet? I have the same problem. Lerna does not correctly generate the changelog, it just leaves a note: "Version bump only for package "

@dforesman
Copy link

This issue has been a thorn in my organization's side for some time now, and is affecting our ability to effectively use Dependabot to keep internal dependencies up-to-date.

We use automated pre-releases on-merge so individual teams can pull in updates immediately, and periodically perform full releases which Dependabot pushes out to all of our apps.

Currently, the changelogs of these 'full releases' consist only of the 'version bump only' text. We then have 10s or 100s of Dependabot PRs opened with the description "version bump only", which teams are hesitant to apply or accept.

The desired behavior would be to mimic the out-of-the-box behavior of semantic-release, wherein changelogs are created for all pre-releases, and graduations then contain a rollup of all pre-releases that led to it.


Rough mockup of what I'm describing

Expected

## 1.1.0

### Features

- Adds feature A

### Bug Fixes

- Fixes feature B

## 1.1.0-prerelease.2

### Bug Fixes

- Fixes feature B


## 1.1.0-prerelease.1

### Features

- Adds feature A

Actual

## 1.1.0

Version bump only for package

## 1.1.0-prerelease.2

### Bug Fixes

- Fixes feature B


## 1.1.0-prerelease.1

### Features

- Adds feature A

@ricmello
Copy link

ricmello commented May 1, 2024

I could finally achieve the changelog generation only for prod versions using the --git-tag-command flag:

Prerelease:

lerna publish --preid prerelease --conventional-commits --conventional-prerelease --no-changelog --git-tag-command="echo 'skipping git tag for prereleases'"

Production:

lerna publish --conventional-commits --conventional-graduate

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

No branches or pull requests

8 participants