Skip to content

Question: Merging pre-release branches & generated changelog #606

Open
@fjakop

Description

We're using semantic-release in our projects with many collaborators. When we develop a new feature we're creating a pre-release branch which publishes to a dist-tag named according to this branch name, so other developers can use it.

Let's say we develop feature-foo, we get pre-releases with dist-tag @feature-foo and tags x.y.z-feature-foo.1 and so on (x.y.z is the previous release version on that branch).

Since we have activated semantic-release/changelog in our .releaserc.json (see below), every pre-release will get a changelog entry according to its commit comments and a release header like this:

CHANGELOG.md

### Features

*  My commit comment 2 ([d762374](link omitted))

# [x.y.z-feature-foo.2](link omitted) (2024-2-14)


### Features

*  My commit comment 1 ([4e6731c](link omitted))

# [x.y.z-feature-foo.1](link omitted) (2024-2-14)

Now when the feature is finished, we merge the feature branch by Gitlab Mmerge request to the main branch. This causes the changelog file and every pre-release entry to be merged into the main branch changelog too, which clutters the changelog and is clearly not desired.

Now the questions:

  • How is this intended to be handled?
  • Has someone else the same problem?
  • Are we doing something strange/wrong?

Kind regards
Frank

.releaserc.json

{
  "branches": [
    {"name": "feature-([0-9A-Za-z-]+)", "prerelease": true},
  ],
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "@semantic-release/changelog",
    "@semantic-release/gitlab",
    "@semantic-release/npm",
    [
      "@semantic-release/git",
      {
        "assets": ["package.json", "CHANGELOG.md"],
        "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
      }
    ]
  ]
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions