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

[Feature] allow customizing the monorepo tag format injected in context.nextRelease #103

Open
tinesoft opened this issue Apr 1, 2021 · 2 comments

Comments

@tinesoft
Copy link

tinesoft commented Apr 1, 2021

Hi @pmowrer

First of all, thanks for this awesome project! Exactly what I was looking for to release my Nx-based monorepo (https://github.com/tinesoft/nxrocks).

Is it possible to allow customizing the default monorepo tag format injected in context.nextRelease ? (currently it is <package-name>-v-<version>)

In my case, one of the packages in the monorepo is named: @nxrocks/nx-spring-boot. So the plugin
renders @nxrocks/nx-spring-boot-v-<version>, while I would like simply nx-spring-boot/v-<version>...

With the global tagFormat I was able to change the name of the created tag, but this name is not applied everywhere, in particular not in the context.nextRelease.version. Instead, the default format is picked up by the other plugins like @semantic-release/release-notes-generator.

Here is a sample: https://github.com/tinesoft/nxrocks/releases/tag/nx-spring-boot%2Fv2.0.0-beta.1

image

I believe it is because the default monorepo tag format is hardcoded here:

return `${name}-v${version}`;

the name is read from the package via const { name } = await readPkg();

An option could be added to allow customizing it.

This is what my .releaserc file looks like:

{
    extends: 'semantic-release-monorepo',
    preset: 'angular',
    plugins: [
      '@semantic-release/commit-analyzer',
      '@semantic-release/release-notes-generator', 
      '@semantic-release/changelog',
      '@semantic-release/github',
      ['@semantic-release/npm', { pkgRoot: relativeBuildOutput }],
      [
        '@semantic-release/exec',
        {
          prepareCmd: [
            formatFile(`${projectRoot}/CHANGELOG.md`),
            copyFile(`${projectRoot}/CHANGELOG.md`, buildOutput),
            copyFile(`${projectRoot}/README.md`, buildOutput),
            copyFile(`LICENSE`, buildOutput),
          ].join(' && '),
          execCwd: relativeWorkspaceRoot,
        },
      ],
      [
        '@semantic-release/git',
        {
          message: releaseCommit,
        },
      ],
    ],
    tagFormat: `${projectScope}/v\${version}` // note: projectScope is dynamically injected
  }
@pmowrer
Copy link
Owner

pmowrer commented Apr 6, 2021

Hi @tinesoft and thanks for the thorough issue report! Off-hand, I can't think of a reason why version-to-git-tag shouldn't be using tagFormat. I'll have a look soon!

@Blackclaws
Copy link

Having the same problem. We have changelog files in each of the repos and we'd like to customize the header as we aren't even publishing npm packages so that name is just a placeholder.

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

3 participants