GithubHelp home page GithubHelp logo

semantic-release-monorepo's Introduction

semantic-release-monorepo

Tests workflow npm semantic-release

Apply semantic-release's automatic publishing to a monorepo.

Why

The default configuration of semantic-release assumes a one-to-one relationship between a GitHub repository and an npm package.

This library allows using semantic-release with a single GitHub repository containing many npm packages.

How

Instead of attributing all commits to a single package, commits are assigned to packages based on the files that a commit touched.

If a commit touched a file in or below a package's root, it will be considered for that package's next release. A single commit can belong to multiple packages and may trigger the release of multiple packages.

In order to avoid version collisions, generated git tags are namespaced using the given package's name: <package-name>-<version>.

Install

Both semantic-release and semantic-release-monorepo must be accessible in each monorepo package.

npm install -D semantic-release semantic-release-monorepo

Usage

Run semantic-release in an individual monorepo package and apply semantic-release-monorepo via the extends option.

On the command line:

$ npm run semantic-release -e semantic-release-monorepo

Or in the release config:

{
  "extends": "semantic-release-monorepo"
}

NOTE: This library CAN'T be applied via the plugins option.

{
  "plugins": [
    "semantic-release-monorepo" // This WON'T work
  ]
}

With Yarn Workspaces

$ yarn workspaces run semantic-release -e semantic-release-monorepo

With Lerna

The monorepo management tool lerna can be used to run semantic-release-monorepo across all packages in a monorepo with a single command:

lerna exec --concurrency 1 -- npx --no-install semantic-release -e semantic-release-monorepo

With pnpm

pnpm has built-in workspace functionality for monorepos. Similarly to the above, you can use pnpm to make release in all packages:

pnpm -r --workspace-concurrency=1 exec -- npx --no-install semantic-release -e semantic-release-monorepo

Thanks to how npx's package resolution works, if the repository root is in $PATH (typically true on CI), semantic-release and semantic-release-monorepo can be installed once in the repo root instead of in each individual package, likely saving both time and disk space.

Advanced

This library modifies the context object passed to semantic-release plugins in the following way to make them compatible with a monorepo.

Step Description
analyzeCommits Filters context.commits to only include the given monorepo package's commits.
generateNotes
  • Filters context.commits to only include the given monorepo package's commits.
  • Modifies context.nextRelease.version to use the monorepo git tag format. The wrapped (default) generateNotes implementation uses this variable as the header for the release notes. Since all release notes end up in the same Github repository, using just the version as a header introduces ambiguity.

tagFormat

Pre-configures the tagFormat option to use the monorepo git tag format.

If you are using Lerna, you can customize the format using the following command:

"semantic-release": "lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo --tag-format='${LERNA_PACKAGE_NAME}-v\\${version}'"

Where '${LERNA_PACKAGE_NAME}-v\\${version}' is the string you want to customize. By default it will be <PACKAGE_NAME>-v<VERSION> (e.g. foobar-v1.2.3).

semantic-release-monorepo's People

Contributors

alisd23 avatar baskiers avatar bogaertg avatar fezvrasta avatar piperchester avatar pmowrer avatar privatenumber avatar solaris007 avatar wtgtybhertgeghgtwtg avatar yenbekbay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

semantic-release-monorepo's Issues

Lerna exec not executing properly in conjunction with semantic-release-monorepo

Setting up a monorepo environment we found that lerna does not execute the semantic-release command, provided in the README of this package, correctly. --concurrency 1 does not work and lerna spawns 4 processes at once and the flags for semantic-release-monorepo like --tag-format do not work.

Looking in to it it seems that the -- option of lerna is deprecated and should be omitted. When ommitting -- the concurrency seems to work and the --tag-format option also works as expected.

The command that was not working was:

yarn lerna exec --concurrency 1 -- npx --no-install semantic-release -e semantic-release-monorepo -d --debug

We got it working by changing it to this:

yarn lerna exec --concurrency 1 "npx --no-install semantic-release -e semantic-release-monorepo -d --debug"

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Allow read-pkg to be higher major version to fix Yarn 2.0 issues

When using Yarn 2.0 with semantic-release-monorepo, an error occurs when attempting to execute readpkg.sync()

This is because the version of read-pkg (3.0.0) is very out of date (more than 3 years old) and breaks with yarn 2.0.

Could you upgrade to a newer version? Even upgrading to version 4.0.0 would correct the issue. If you did this, it would mean semantic-release-monorepo would require at least NodeJS 6.0 as read-pkg 4.0.0 requires Node 6. read-pkg v3.0.0 requires NodeJS 4 so you're not really adding much of a restriction.

If you're not willing to add that restriction, could you at least change the package dependency to ">=3.0.0" instead of "^3.0.0" so that projects that depend on this with yarn 2.0 continue to function?

How to enable git/changelog plugins?

First off, great lib, it's working flawlessly on our monorepo.

That being said, we're looking to experiment with the git plugin (to sync our package.json files) and the changelog plugin (to log each package individually). I can't seem to get either of these to run.

I've tried both:

module.exports = {
  extends: 'semantic-release-monorepo',
  plugins: [
    '@semantic-release/commit-analyzer',
    '@semantic-release/release-notes-generator',
    [
      '@semantic-release/changelog',
      {
        changelogFile: 'CHANGELOG.md',
        changelogTitle: 'Changelog',
      },
    ],
    '@semantic-release/npm',
    [
      '@semantic-release/git',
      {
        assets: ['CHANGELOG.md', 'package.json', 'packages/*/*/package.json'],
        // eslint-disable-next-line no-template-curly-in-string
        message: 'Build: ${nextRelease.gitTag} [skip ci]',
      },
    ],
    '@semantic-release/github',
  ],
};

And under the monorepo property:

module.exports = {
  extends: 'semantic-release-monorepo',
  monorepo: {
    plugins: [
      '@semantic-release/commit-analyzer',
      '@semantic-release/release-notes-generator',
      [
        '@semantic-release/changelog',
        {
          changelogFile: 'CHANGELOG.md',
          changelogTitle: 'Changelog',
        },
      ],
      '@semantic-release/npm',
      [
        '@semantic-release/git',
        {
          assets: ['CHANGELOG.md', 'package.json', 'packages/*/*/package.json'],
          // eslint-disable-next-line no-template-curly-in-string
          message: 'Build: ${nextRelease.gitTag} [skip ci]',
        },
      ],
      '@semantic-release/github',
    ],
  },
};

With no luck. Assuming this isn't supported atm.

semantic-release-monorepo is broken because of [email protected]

Hello,

First off, I've copied and pasted this from the issue I created for semantic-release-plugin-decorators, so apologies for describing your own module to you. 😅

We use lerna, semantic-release and semantic-release-monorepo to version and publish our projects' shared modules.

The change that triggered [email protected] has broken our pipeline.

This is because in order to use semantic-release-monorepo you need to put your analyzeCommits and generateNotes configurations inside a monorepo Object of your release configuration.
See the semantic-release-monorepo: Example of use with non-default set of plugins for an example of this.

If we include an release.analyzeCommits configuration, then semantic-release-monorepo does not execute at all. If we put it inside a monorepo Object, as outlined above, then it is now ignored because of the change in [email protected] and as such, neither out preset: eslint, nor our custom releaseRules: Object get picked up by semantic-release-monorepo, which then prevents semantic-release from versioning and publishing, as it can't find any valid changes.

Since you're the owner of both modules, I'm unsure about where you want to make the fix, however, it would be great if you could fix it, I don't know if other people are experiencing the same issue or not, but it may only be a matter of time.

For now, we've hard versioned semantic-release-plugin-decorators to v1.2.1, at the same time, it would be nice to not be locked into this version to be able to receive future updates. 🙂

Thanks,
Christos.

TypeError: plugin is not a function

Hello! First off thank you for the work on this plugin, it looks great and is filling a void. I'm hoping to be able to use it, but am running into a TypeError. semantic-release v17.0.4 and semantic-release-monorepo v7.0.2. The semantic-release commit analyzer is working fine by itself. There's a dearth of functional examples, so perhaps it's possible that I need to include something in the release config that I am not? I have included the log and my very simple .releaserc.json. Thank you!

{
  "branches": ["versioning"],
  "repositoryUrl": "[email protected]:DavidSnowberger/tools/pattern-library.git",
  "plugins": [
    "semantic-release-monorepo",
    "@semantic-release/git"
  ],
  "dryRun": true,
  "ci": false,
  "debug": true
}
z-mac-3115:auth david.snowberger$ npx semantic-release -e semantic-release-monorepo --debug
[9:03:42 AM] [semantic-release] › ℹ  Running semantic-release version 17.0.4
  semantic-release:config load config from: /opt/pattern-library/.releaserc.json +0ms
  semantic-release:config options values: {
  semantic-release:config   branches: [ 'versioning' ],
  semantic-release:config   repositoryUrl: '[email protected]:DavidSnowberger/tools/pattern-library.git',
  semantic-release:config   tagFormat: 'auth-v${version}',
  semantic-release:config   plugins: [ 'semantic-release-monorepo', '@semantic-release/git' ],
  semantic-release:config   analyzeCommits: [
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo]
  semantic-release:config   ],
  semantic-release:config   generateNotes: [
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo],
  semantic-release:config     [AsyncFunction: semantic-release-monorepo]
  semantic-release:config   ],
  semantic-release:config   dryRun: true,
  semantic-release:config   ci: false,
  semantic-release:config   debug: true,
  semantic-release:config   _: [],
  semantic-release:config   e: [ 'semantic-release-monorepo' ],
  semantic-release:config   '$0': '../../node_modules/.bin/semantic-release',
  semantic-release:config   noCi: true
  semantic-release:config } +979ms
  semantic-release:plugins options for @semantic-release/git/verifyConditions: {} +0ms
[9:03:43 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/git"
  semantic-release:plugins options for [Function: semantic-release-monorepo]/analyzeCommits: {} +1ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/analyzeCommits: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/analyzeCommits: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/analyzeCommits: {} +1ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/analyzeCommits: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/analyzeCommits: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/analyzeCommits: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/analyzeCommits: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/analyzeCommits: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/analyzeCommits: {} +1ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/generateNotes: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/generateNotes: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/generateNotes: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/generateNotes: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/generateNotes: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/generateNotes: {} +1ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/generateNotes: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/generateNotes: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/generateNotes: {} +0ms
  semantic-release:plugins options for [Function: semantic-release-monorepo]/generateNotes: {} +0ms
  semantic-release:plugins options for @semantic-release/git/prepare: {} +0ms
[9:03:43 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
  semantic-release:get-tags found tags for branch versioning: [ { gitTag: 'auth-v0.3.1', version: '0.3.1', channels: [ null ] }, { gitTag: 'auth-v0.6.0', version: '0.6.0', channels: [ null ] }, { gitTag: 'auth-v0.7.0', version: '0.7.0', channels: [ null ] }, { gitTag: 'auth-v0.8.0', version: '0.8.0', channels: [ null ] } ] +0ms
[9:03:51 AM] [semantic-release] › ⚠  Run automated release from branch versioning on repository [email protected]:DavidSnowberger/tools/pattern-library.git in dry-run mode
[9:03:54 AM] [semantic-release] › ✔  Allowed to push to the Git repository
[9:03:54 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/git"
[9:03:54 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/git"
[9:03:54 AM] [semantic-release] › ℹ  Found git tag auth-v0.8.0 associated with version 0.8.0 on branch versioning
  semantic-release:get-commits Use from: 6e31621904c0c85b4e9d119be8a3163beb232621 +0ms
[9:03:54 AM] [semantic-release] › ℹ  Found 1 commits since last release
  semantic-release:get-commits Parsed commits: [ { commit: { long: 'e50dfaea685e69c30024fcb7498fe1df8b72a644', short: 'e50dfae' }, tree: { long: '89f6ae833ad0bf6ca403bbcec8174581907279f3', short: '89f6ae8' }, author: { name: 'David Snowberger', email: '[email protected]', date: 2020-04-08T00:20:54.000Z }, committer: { name: 'David Snowberger', email: '[email protected]', date: 2020-04-08T00:20:54.000Z }, subject: 'feat: MODIFY AUTH TESTFILE 4', body: '', hash: 'e50dfaea685e69c30024fcb7498fe1df8b72a644', committerDate: 2020-04-08T00:20:54.000Z, message: 'feat: MODIFY AUTH TESTFILE 4', gitTags: '(HEAD -> versioning)' } ] +31ms
[9:03:54 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
  semantic-release:monorepo Running 'analyzeCommits' version '7.0.2' +0ms
  semantic-release:monorepo Filter commits by package path: "projects/auth" +0ms
  semantic-release:monorepo Including commit "feat: MODIFY AUTH TESTFILE 4" because it modified package file "projects/auth/TESTFILE". +26ms
[9:03:54 AM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ  Found 1 commits for package auth since last release
[9:03:54 AM] [semantic-release] › ✖  Failed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
[9:03:54 AM] [semantic-release] › ✖  An error occurred while running semantic-release: TypeError: plugin is not a function
    at /opt/pattern-library/node_modules/semantic-release-monorepo/src/only-package-commits.js:83:10
    at async validator (/opt/pattern-library/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async /opt/pattern-library/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async Promise.all (index 0)
    at async next (/opt/pattern-library/node_modules/semantic-release/node_modules/p-reduce/index.js:16:18) {
  pluginName: '[Function: semantic-release-monorepo]'
}
TypeError: plugin is not a function
    at /opt/pattern-library/node_modules/semantic-release-monorepo/src/only-package-commits.js:83:10
    at async validator (/opt/pattern-library/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async /opt/pattern-library/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async Promise.all (index 0)
    at async next (/opt/pattern-library/node_modules/semantic-release/node_modules/p-reduce/index.js:16:18) {
  pluginName: '[Function: semantic-release-monorepo]'
}

Edit: to provide a bit more info, I have just tried this with a brand new repo with only a package.json and also tried using @semantic-release/gitlab with a token instead of @semantic-release/git with the same result.

Unable to change the commit message format for semantic-release/git plugin

Hi,

I have been using semantic-release-monorepo for a while now. However, I have a requirement which has come up to remove [skip ci] from the chore commits.

I am using the cli command as npx lerna exec --concurrency 1 -- npx semantic-release -e semantic-release-monorepo

I noticed that passing the below plugin configuration in package.json at the root of the repo isn't loading the semantic-release/git plugin.

"plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "@semantic-release/npm",
    "@semantic-release/git",
         {
        "assets": [
          "lerna.json",
          "package.json",
          "package-lock.json",
          "CHANGELOG.md"
        ],
        "message": "chore(release): ${nextRelease.version} \n\n${nextRelease.notes}"
      }
    "@semantic-release/github"
  ]

I also tried below format

"plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "@semantic-release/npm",
    [ "@semantic-release/git",
         {
        "assets": [
          "lerna.json",
          "package.json",
          "package-lock.json",
          "CHANGELOG.md"
        ],
        "message": "chore(release): ${nextRelease.version} \n\n${nextRelease.notes}"
      }],
    "@semantic-release/github"
  ]

I tried customizing the semantic-release/git plugin in prepare field as below

 "release": {
      "prepare": [
          "@semantic-release/npm",
          "@semantic-release/git",
               {
              "assets": [
                "lerna.json",
                "package.json",
                "package-lock.json",
                "CHANGELOG.md"
              ],
              "message": "chore(release): ${nextRelease.version} \n\n${nextRelease.notes}"
            }
       ]
       }, 

which gives me an error

✖  EPLUGINCONF The `prepare` plugin configuration is invalid.
The prepare plugin configuration (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/plugins.md#prepare-plugin)  must be a single or an array of plugins definition. A plugin definition is an npm module name, optionnaly wrapped in an array with an object.

It would be helpful if a workaround is provided to modify the message for the chore commit.

Reference Already Exists

Thanks for this lib, it looks like just what we need for our monorepo project. However, we are running into an issue where two commits to two different packages in the same CI run are failing. Is this something that is supported? Here is the output from the release script -

We are using Bolt to run a release command in each package -

bolt ws run release
⚡️   bolt v0.20.7 (node v9.4.0)
[Semantic release]: Running semantic-release version 15.6.3
[Semantic release]: Running semantic-release version 15.6.3
[Semantic release]: Load plugin "verifyConditions" from @semantic-release/npm
[Semantic release]: Load plugin "verifyConditions" from @semantic-release/npm
[Semantic release]: Load plugin "verifyConditions" from @semantic-release/github
[Semantic release]: Load plugin "verifyConditions" from @semantic-release/github
[Semantic release]: Load plugin "prepare" from @semantic-release/npm
[Semantic release]: Load plugin "publish" from @semantic-release/npm
[Semantic release]: Load plugin "publish" from @semantic-release/github
[Semantic release]: Load plugin "success" from @semantic-release/github
[Semantic release]: Load plugin "prepare" from @semantic-release/npm
[Semantic release]: Load plugin "fail" from @semantic-release/github
[Semantic release]: Load plugin "publish" from @semantic-release/npm
[Semantic release]: Load plugin "publish" from @semantic-release/github
[Semantic release]: Load plugin "success" from @semantic-release/github
[Semantic release]: Load plugin "fail" from @semantic-release/github
[Semantic release]: Run automated release from branch chore/release-setup
[Semantic release]: Call plugin verify-conditions
[Semantic release]: Verify authentication for registry https://registry.npmjs.org/
[Semantic release]: Run automated release from branch chore/release-setup
[Semantic release]: Call plugin verify-conditions
[Semantic release]: Verify authentication for registry https://registry.npmjs.org/
[Semantic release]: Verify GitHub authentication
[Semantic release]: Verify GitHub authentication
[Semantic release]: No git tag version found
[Semantic release]: No previous release found, retrieving all commits
[Semantic release]: Found 232 commits since last release
[Semantic release]: Call plugin analyze-commits
[Semantic release]: No git tag version found
[Semantic release]: No previous release found, retrieving all commits
[Semantic release]: Found 232 commits since last release
[Semantic release]: Call plugin analyze-commits
[Semantic release]: Found 2 commits for package @ghostgroup/ui.analytics since last release
[Semantic release]: Analyzing commit: feat(component-analytics): add release

Add release script to analytics package
[Semantic release]: The release type for the commit is minor
[Semantic release]: Analyzing commit: WIP for :eyes:
[Semantic release]: The commit should not trigger a release
[Semantic release]: Analysis of 2 commits complete: minor release
[Semantic release]: There is no previous release, the next release version is 1.0.0
[Semantic release]: Call plugin verify-release
[Semantic release]: Call plugin generateNotes
[Semantic release]: Found 2 commits for package @ghostgroup/ui.analytics since last release
[Semantic release]: Call plugin prepare
[Semantic release]: Found 3 commits for package @ghostgroup/ui.animated-stars since last release
[Semantic release]: Analyzing commit: feat(component-animated-stars): release setup for animated stars
[Semantic release]: The release type for the commit is minor
[Semantic release]: Analyzing commit: feat(component-analytics): add release

Add release script to analytics package
[Semantic release]: The release type for the commit is minor
[Semantic release]: Analyzing commit: WIP for :eyes:
[Semantic release]: The commit should not trigger a release
[Semantic release]: Analysis of 3 commits complete: minor release
[Semantic release]: There is no previous release, the next release version is 1.0.0
[Semantic release]: Wrote version 1.0.0 to package.json
[Semantic release]: Call plugin verify-release
[Semantic release]: Call plugin generateNotes
[Semantic release]: Create tag @ghostgroup/ui.analytics-v1.0.0
[Semantic release]: Found 3 commits for package @ghostgroup/ui.animated-stars since last release
[Semantic release]: Call plugin prepare
[Semantic release]: Wrote version 1.0.0 to package.json
[Semantic release]: Create tag @ghostgroup/ui.animated-stars-v1.0.0
[Semantic release]: An error occurred while running semantic-release: { Error: Command failed: git push --tags https://[secure]@github.com/GhostGroup/ui.git HEAD:chore/release-setup
To https://github.com/GhostGroup/ui.git
 ! [remote rejected] @ghostgroup/ui.analytics-v1.0.0 -> @ghostgroup/ui.analytics-v1.0.0 (cannot lock ref 'refs/tags/@ghostgroup/ui.analytics-v1.0.0': reference already exists)
error: failed to push some refs to 'https://[secure]@github.com/GhostGroup/ui.git'


    at makeError (/home/ubuntu/ui/node_modules/execa/index.js:172:9)
    at Promise.all.then.arr (/home/ubuntu/ui/node_modules/execa/index.js:277:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
  code: 1,
  stdout: '',
  stderr: 'To https://github.com/GhostGroup/ui.git\n ! [remote rejected] @ghostgroup/ui.analytics-v1.0.0 -> @ghostgroup/ui.analytics-v1.0.0 (cannot lock ref \'refs/tags/@ghostgroup/ui.analytics-v1.0.0\': reference already exists)\nerror: failed to push some refs to \'https://[secure]@github.com/GhostGroup/ui.git\'\n',
  failed: true,
  signal: null,
  cmd: 'git push --tags https://[secure]@github.com/GhostGroup/ui.git HEAD:chore/release-setup',
  timedOut: false,
  killed: false }
{ Error: Command failed: git push --tags https://<redacted>@github.com/GhostGroup/ui.git HEAD:chore/release-setup
To https://github.com/GhostGroup/ui.git
 ! [remote rejected] @ghostgroup/ui.analytics-v1.0.0 -> @ghostgroup/ui.analytics-v1.0.0 (cannot lock ref 'refs/tags/@ghostgroup/ui.analytics-v1.0.0': reference already exists)
error: failed to push some refs to 'https://<redacted>@github.com/GhostGroup/ui.git'


    at makeError (/home/ubuntu/ui/node_modules/execa/index.js:172:9)
    at Promise.all.then.arr (/home/ubuntu/ui/node_modules/execa/index.js:277:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
  code: 1,
  stdout: '',
  stderr: 'To https://github.com/GhostGroup/ui.git\n ! [remote rejected] @ghostgroup/ui.analytics-v1.0.0 -> @ghostgroup/ui.analytics-v1.0.0 (cannot lock ref \'refs/tags/@ghostgroup/ui.analytics-v1.0.0\': reference already exists)\nerror: failed to push some refs to \'https://<redacted>@github.com/GhostGroup/ui.git\'\n',
  failed: true,
  signal: null,
  cmd: 'git push --tags https://<redacted>@github.com/GhostGroup/ui.git HEAD:chore/release-setup',
  timedOut: false,
  killed: false }
error Command failed with exit code 1.
error Error
error     at ChildProcess.child.on.code (/home/ubuntu/.config/yarn/global/node_modules/bolt/dist/modern/utils/processes.js:121:16)

bolt ws run release returned exit code 1

Action failed: bolt ws run release

Is there a configuration option I am missing or is this workflow not supported?

lerna semantic-release-monorepo babel

Hey there, thanks for the awesome project.

I was wondering if there's a way to kick off a build to @babel/cli when semantic-release-monorepo figures out which packages to publish.

Question/issue how to manage updating local dependencies after versioning?

First, thanks for this extension.
I wanted to ask how to handle the updating of version numbers on local dependencies.

For example:
semantic-release detects a change on module-A(1.0.0) and releases module-A(1.0.1)
module-B has a dependency on module-A, but package.json still references module-a(1.0.0)

How to include that version bump on the module-B release?

Does this also work with a config file in the root directory when using lerna?

So, the readme is pretty scarce on this.

lerna exec --concurrency 1 -- npx --no-install semantic-release -e semantic-release-monorepo

Should I add semantic-release and semantic-release-monorepo to the devDependencies beforehand (as hinted by the --no-install flag) or are these dependencies installed with npx?
Also, can I use a config file in my monorepo root directory instead of passing all configuration options as cli arguments like above?
I'd appreciate some clarification. Thanks!

TypeError: Cannot destructure property 'githubUrl' of 'undefined' as it is undefined

Here is the error message

[4:00:00 AM] [semantic-release] › ℹ  Start step "success" of plugin "[Function: semantic-release-monorepo]"
[4:00:00 AM] [semantic-release] › ✔  Completed step "success" of plugin "[Function: semantic-release-monorepo]"
[4:00:00 AM] [semantic-release] › ✖  An error occurred while running semantic-release: TypeError: Cannot destructure property 'githubUrl' of 'undefined' as it is undefined.
    at module.exports (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/@semantic-release/github/lib/resolve-config.js:5:5)
    at module.exports (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/@semantic-release/github/lib/success.js:33:7)
    at success (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/@semantic-release/github/index.js:55:9)
    at /home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release-monorepo/src/options-transforms.js:16:10
    at async validator (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async /home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async Promise.all (index 0)
    at async next (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/node_modules/p-reduce/index.js:16:18) {
  pluginName: '[Function: semantic-release-monorepo]'
}
AggregateError: 
    TypeError: Cannot destructure property 'githubUrl' of 'undefined' as it is undefined.
        at module.exports (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/@semantic-release/github/lib/resolve-config.js:5:5)
        at module.exports (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/@semantic-release/github/lib/success.js:33:7)
        at success (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/@semantic-release/github/index.js:55:9)
        at /home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release-monorepo/src/options-transforms.js:16:10
        at async validator (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
        at async /home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
        at async Promise.all (index 0)
        at async next (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/node_modules/p-reduce/index.js:16:18)
    at /home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/lib/plugins/pipeline.js:54:11
    at async Object.pluginsConf.<computed> [as success] (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/lib/plugins/index.js:80:11)
    at async run (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/index.js:201:3)
    at async module.exports (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/index.js:260:22)
    at async module.exports (/home/runner/work/commit-gitmoji/commit-gitmoji/node_modules/semantic-release/cli.js:55:5)lerna ERR! semantic-release exited 1 in 'conventional-changelog-gitmoji-config'
lerna ERR! semantic-release exited 1 in 'conventional-changelog-gitmoji-config'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
error Command failed with exit code 1.

my release config is :

// root
module.exports = {
  extends: 'semantic-release-monorepo',
  plugins: [
    [
      '@semantic-release/commit-analyzer',
      {
        config: 'conventional-changelog-gitmoji-config',
      },
    ],
    [
      '@semantic-release/release-notes-generator',
      {
        config: 'conventional-changelog-gitmoji-config',
      },
    ],
  ],
};

// package
const base = require('../../.releaserc');

module.exports = {
  ...base,
  plugins: [
    ...base.plugins,
    [
      '@semantic-release/changelog',
      {
        changelogFile: 'CHANGELOG.md',
        changelogTitle: '# commitlint-config-gitmoji 更新日志',
      },
    ],
    '@semantic-release/npm',
    ['@semantic-release/github'],
    [
      '@semantic-release/git', 
      {
        assets: [
          'CHANGELOG.md',
          'package.json',
        ],
        message: ':bookmark: chore(release): ${nextRelease.gitTag} [skip ci] \n\nhttps://github.com/arvinxx/commit-gitmoji/releases/tag/${nextRelease.gitTag}',
      },
    ],
  ],
};

Looks like it doesn't work with the latest semantic-release and plugins

It seems that from semantic-release version 15.8.0 they changed some configuration options and updated own plugins to follow this. Every official semantic release plugin have a commit like this:

feat: use `cwd` and `env` options passed by core

BREAKING CHANGE: require `semantic-release` >= `15.8.0`

I think that's why semantic-release-plugin-decorators can't properly wrap new plugins and behavior

This is my log:

[8:56:26 AM] [semantic-release] › ℹ  Running semantic-release version 15.9.12
[8:56:26 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/changelog" in shareable config "../../tools/semantic-release"
[8:56:26 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/npm" in shareable config "../../tools/semantic-release"
[8:56:26 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/git" in shareable config "../../tools/semantic-release"
[8:56:26 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github" in shareable config "../../tools/semantic-release"
[8:56:26 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog" in shareable config "../../tools/semantic-release"
[8:56:26 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/npm" in shareable config "../../tools/semantic-release"
[8:56:26 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/git" in shareable config "../../tools/semantic-release"
[8:56:26 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm" in shareable config "../../tools/semantic-release"
[8:56:26 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github" in shareable config "../../tools/semantic-release"
[8:56:26 AM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github" in shareable config "../../tools/semantic-release"
[8:56:26 AM] [semantic-release] › ✔  Run automated release from branch master
[8:56:28 AM] [semantic-release] › ✔  Allowed to push to the Git repository
[8:56:28 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/changelog"
[8:56:28 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/changelog"
[8:56:28 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/npm"
[8:56:28 AM] [semantic-release] [@semantic-release/npm] › ℹ  Verify authentication for registry https://registry.npmjs.org/
[8:56:30 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/npm"
[8:56:30 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/git"
[8:56:30 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/git"
[8:56:30 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
[8:56:30 AM] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication
[8:56:31 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/github"
[8:56:32 AM] [semantic-release] › ℹ  Found git tag @casl/[email protected] associated with version 0.7.2
[8:56:32 AM] [semantic-release] › ℹ  Found 26 commits since last release
[8:56:32 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "[Function: ]"
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Found 18 commits for package @casl/react since last release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: chore(package): get rid of local semantic-release dep
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: feat(react:can): updates typescript declarations
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The release type for the commit is minor
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: Revert "feat(react:can): updates typescript declarations"

This reverts commit 213dcde0286482aafc86e66a2ea0c49f630108f0.
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: feat(react:can): updates typescript declarations
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The release type for the commit is minor
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: chore(deps): lock file maintenance
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: chore(deps): lock file maintenance
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: chore(eslint): fixes eslint errors
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: perf(react:can): moves prop type checks undef `if`, so they can be removed for production builds
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The release type for the commit is patch
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: feat(react:can): adds `passThrough` option

Relates to #105
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The release type for the commit is minor
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: feat(react:can): adds `an` alias to `on` prop
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The release type for the commit is minor
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: docs(react:readme): updates examples with render children prop
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: test(react:can): covers multiple children rendering
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: feat(react:can): adds support for multiple <Can> children
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The release type for the commit is minor
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: chore(deps): lock file maintenance
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: chore(deps): lock file maintenance
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: fix(README): changes links to @casl/ability to point to npm package instead to git root [skip ci]

Fixes #102
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The release type for the commit is patch
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: chore(deps): lock file maintenance
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analyzing commit: chore(deps): lock file maintenance
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  The commit should not trigger a release
[8:56:32 AM] [semantic-release] [[Function: ]] › ℹ  Analysis of 18 commits complete: minor release
[8:56:32 AM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "[Function: ]"
[8:56:32 AM] [semantic-release] › ℹ  The next release version is 0.8.0
[8:56:32 AM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "[Function: ]"
[8:56:32 AM] [semantic-release] › ✖  Failed step "generateNotes" of plugin "[Function: ]"
[8:56:32 AM] [semantic-release] › ✖  An error occurred while running semantic-release: { TypeError: Expected `moduleId` to be of type `string`, got `object`
    at resolveFrom (/home/sergii/projects/casl/node_modules/import-from/node_modules/resolve-from/index.js:11:9)
    at module.exports (/home/sergii/projects/casl/node_modules/import-from/node_modules/resolve-from/index.js:34:41)
    at module.exports (/home/sergii/projects/casl/node_modules/import-from/index.js:4:49)
    at requirePlugin (/home/sergii/projects/casl/node_modules/semantic-release-plugin-decorators/src/index.js:4:33)
    at resolvePluginFn (/home/sergii/projects/casl/node_modules/semantic-release-plugin-decorators/src/index.js:18:18)
    at /home/sergii/projects/casl/node_modules/semantic-release-plugin-decorators/src/index.js:26:20
    at validator (/home/sergii/projects/casl/node_modules/semantic-release/lib/plugins/normalize.js:34:28)
    at pReduce (/home/sergii/projects/casl/node_modules/semantic-release/lib/plugins/pipeline.js:37:40)
    at Promise.all.then.value (/home/sergii/projects/casl/node_modules/p-reduce/index.js:16:10)
    at process._tickCallback (internal/process/next_tick.js:68:7) pluginName: '[Function: ]' }
{ TypeError: Expected `moduleId` to be of type `string`, got `object`
    at resolveFrom (/home/sergii/projects/casl/node_modules/import-from/node_modules/resolve-from/index.js:11:9)
    at module.exports (/home/sergii/projects/casl/node_modules/import-from/node_modules/resolve-from/index.js:34:41)
    at module.exports (/home/sergii/projects/casl/node_modules/import-from/index.js:4:49)
    at requirePlugin (/home/sergii/projects/casl/node_modules/semantic-release-plugin-decorators/src/index.js:4:33)
    at resolvePluginFn (/home/sergii/projects/casl/node_modules/semantic-release-plugin-decorators/src/index.js:18:18)
    at /home/sergii/projects/casl/node_modules/semantic-release-plugin-decorators/src/index.js:26:20
    at validator (/home/sergii/projects/casl/node_modules/semantic-release/lib/plugins/normalize.js:34:28)
    at pReduce (/home/sergii/projects/casl/node_modules/semantic-release/lib/plugins/pipeline.js:37:40)
    at Promise.all.then.value (/home/sergii/projects/casl/node_modules/p-reduce/index.js:16:10)
    at process._tickCallback (internal/process/next_tick.js:68:7) pluginName: '[Function: ]' }

monorepo cross-dependencies

Hey, this is just a question, would appreciate the help

Imagine the scenario where we have a monorepo and packages depend on each other
lets say they are to be updated at the same time and they are all at version 0.0.1

Lets assume we have packages A,B,C

A
depends on B,C
B depends on C

A is updated to version 1.0.0 with B,C deps 0.0.1
B updated to 1.0.0 with C dep 0.0.1
C updated to 1.0.0

Do i need to then perform another round of updates where B is updated to 1.0.1 with correct C dependency and then A is updated to new B and new C dependency?

Or the deps are resolved automatically and their versions are updated automatically and then lock files are also correctly updated?

If not - is there any approach that I should adopt to avoid the scenario above?
Thanks for all the help and sorry if the question sounds confusing, but I do hope I've described it in a more or less clear way

How to `semantic-release-cli setup` for a monorepo

Hi there, thanks for this package!
We've got a multi-package repo that we wish to publish using semantic-release on Jenkins, but even on my local machine, I can't seem to get past GitHub Enterprise / Artifactory NPM authentication hurdles (https://github.com/semantic-release/cli/issues/115) which I feel are getting compounded by me also trying to get ~-monorepo to work.

What are the steps to follow to use semantic-release-cli setup together with semantic-release-monorepo?

Or alternatively, what key/value pairs in which package.json files coupled with what env variables or cli flags need to be present?

Example monorepo / tutorials

First of all: Thanks a lot for working on this package – it looks very promising. I couldn't find any example monorepo and/or tutorials. Would you mind providing some? 🙏

Missing name in console output

I see a bunch of these [Function: ]

[4:39:33 PM] [semantic-release] [[Function: ]] » i  The commit should not trigger a release

Shouldn't that show the plugin name?

Like

[4:42:03 PM] [semantic-release] [@semantic-release/github] » i  Verify GitHub authentication

Monorepo race condition running for multiple components

[NOTE: Originaled posted here semantic-release/issues/1628]

We are using semantic-release with the plugin semantic-release-monorepo. Our configuration for each component is fairly simple (see below):

The problem comes when running this on CI pipelines for multiple components of the monorepo. If you run this in parallel for component A, B and C, when component A push a tags (and notes) to git, component B and C fails to push due to being outdated.

I'm calling it a "race condition" because it only happens when some commits trigger more than one component at the same time. On these cases, the firsts components (maybe one or two, depending how long each one takes) get published correctly, and all others after that fails. But it fails on pushing git notes (not release notes) and not on pushing tags.

Is there anything that can be done at the plugin level to fix this race condition?

Config:

"dependencies": {  
  "semantic-release": "17.1.1",  
  "semantic-release-monorepo": "7.0.2"  
},  
"release": {  
  "extends": "semantic-release-monorepo",  
  "plugins": [  
    "@semantic-release/commit-analyzer",  
    "@semantic-release/release-notes-generator"  
  ]  
}

Logs:

[semantic-release] An error occurred while running semantic-release: { Error: Command failed with exit code 1: git push https://[secure]@github.com/MY_USER/MY_REPO.git refs/notes/semantic-release
To https://github.com/MY_USER/MY_REPO.git
 ! [rejected]          refs/notes/semantic-release -> refs/notes/semantic-release (fetch first)
error: failed to push some refs to 'https://[secure]@github.com/MY_USER/MY_REPO.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    at makeError (/builds/__MY_REPO__/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/builds/__MY_REPO__/node_modules/execa/index.js:114:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  shortMessage:
   'Command failed with exit code 1: git push https://[secure]@github.com/MY_USER/MY_REPO.git refs/notes/semantic-release',
  command:
   'git push https://[secure]@github.com/MY_USER/MY_REPO.git refs/notes/semantic-release',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr:
   'To https://github.com/MY_USER/MY_REPO.git\n ! [rejected]          refs/notes/semantic-release -> refs/notes/semantic-release (fetch first)\nerror: failed to push some refs to \'https://[secure]@github.com/MY_USER/MY_REPO.git\'\nhint: Updates were rejected because the remote contains work that you do\nhint: not have locally. This is usually caused by another repository pushing\nhint: to the same ref. You may want to first integrate the remote changes\nhint: (e.g., \'git pull ...\') before pushing again.\nhint: See the \'Note about fast-forwards\' in \'git push --help\' for details.',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false }

[UPDATE: We are not using lerna and it doesn't apply to our case because we are not publishing js modules]

Fixed versioning

If using lerna and wanting fixed mode versioning is there a way to get this to respect that?

Help with old Lerna repository

This issue is actually a doubt that I could not resolve reading the documentation.

At work, we have a Lerna-based monorepo in which packages are versioned and released manually. When we tried to start using semantic-release-monorepo, the script assumed that the versions of our packages should begin at 1.0.0, but we already have some releases.

Is it possible to "tell" semantic-release-monorepo the current versions of our packages so that it starts from there?

By the way, I was able to successfully use semantic-release-monorepo in a project in which it was installed from the very beginning.

Nx: App not released when referenced lib has changed

I'm working in an Nx monorepo that contains a lib and an app. The app references the lib. When I change something in the lib a new release of the lib is triggered but not for the app. Is there a possibility to make semantic release realize it has to release a new version of the app as well when dependencies change?

ERR_INVALID_ARG_TYPE

[7:16:25 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ  Found 0 commits for package root since last release

[7:16:25 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ  Analysis of 0 commits complete: no release

[7:16:25 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"

[7:16:25 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"

[7:16:25 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"

[7:16:25 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"

[7:16:25 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"

[7:16:25 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"

[7:16:25 PM] [semantic-release] › ✖  Failed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"

[7:16:25 PM] [semantic-release] › ✖  An error occurred while running semantic-release: TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type object

    at validateString (internal/validators.js:112:11)

    at Module.require (internal/modules/cjs/loader.js:842:3)

    at require (internal/modules/cjs/helpers.js:74:18)

    at semantic-release-monorepo (/opt/apps/partitioned-node/partition-1/fc77c055/workspace/_Excellence_runway_runway_semver/node_modules/semantic-release-plugin-decorators/src/wrapStep.js:41:24)

    at validator (/opt/apps/partitioned-node/partition-1/fc77c055/workspace/_Excellence_runway_runway_semver/node_modules/semantic-release/lib/plugins/normalize.js:34:30)

    at /opt/apps/partitioned-node/partition-1/fc77c055/workspace/_Excellence_runway_runway_semver/node_modules/semantic-release/lib/plugins/pipeline.js:37:40

    at next (/opt/apps/partitioned-node/partition-1/fc77c055/workspace/_Excellence_runway_runway_semver/node_modules/semantic-release/node_modules/p-reduce/index.js:17:9)

    at processTicksAndRejections (internal/process/task_queues.js:93:5) {

  code: 'ERR_INVALID_ARG_TYPE',

  pluginName: '[Function: semantic-release-monorepo]'

}

TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type object

    at validateString (internal/validators.js:112:11)

    at Module.require (internal/modules/cjs/loader.js:842:3)

    at require (internal/modules/cjs/helpers.js:74:18)

    at semantic-release-monorepo (/opt/apps/partitioned-node/partition-1/fc77c055/workspace/_Excellence_runway_runway_semver/node_modules/semantic-release-plugin-decorators/src/wrapStep.js:41:24)

    at validator (/opt/apps/partitioned-node/partition-1/fc77c055/workspace/_Excellence_runway_runway_semver/node_modules/semantic-release/lib/plugins/normalize.js:34:30)

    at /opt/apps/partitioned-node/partition-1/fc77c055/workspace/_Excellence_runway_runway_semver/node_modules/semantic-release/lib/plugins/pipeline.js:37:40

    at next (/opt/apps/partitioned-node/partition-1/fc77c055/workspace/_Excellence_runway_runway_semver/node_modules/semantic-release/node_modules/p-reduce/index.js:17:9)

    at processTicksAndRejections (internal/process/task_queues.js:93:5) {

  code: 'ERR_INVALID_ARG_TYPE',

  pluginName: '[Function: semantic-release-monorepo]'

}error Command failed with exit code 1.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

script returned exit code 1

Here is my release file:

extends: "semantic-release-monorepo"
branches: 
    - master
    - semver
plugins:
    - "@semantic-release/commit-analyzer"
    - "@semantic-release/release-notes-generator"
    - "@semantic-release/changelog"
    - "@semantic-release/npm"
    - "@semantic-release/git"
    - - "@semantic-release/github":
        githubUrl: https://ghe.aa.com,
        githubApiPathPrefix: 'api/v3'

          

Failed step "analyzeCommits" - TypeError: cb is not a function

Hi, I'm trying execute

lerna exec --concurrency 1 -- npx --no-install semantic-release -e semantic-release-monorepo --verify-conditions --dry-run --debug

And get the following output:

> [email protected] debug /Users/projects/commons
> lerna exec --concurrency 1 -- npx --no-install semantic-release -e semantic-release-monorepo --verify-conditions --dry-run --debug

lerna info version 2.11.0
lerna info versioning independent
[4:12:51 PM] [semantic-release] › ℹ  Running semantic-release version 15.9.14
  semantic-release:config options values: { branch: 'poc/semantic-release-monorepo',
  semantic-release:config   repositoryUrl: '.....',
  semantic-release:config   tagFormat: 'my-package-v${version}',
  semantic-release:config   analyzeCommits: [AsyncFunction],
  semantic-release:config   generateNotes:
  semantic-release:config    [ [AsyncFunction],
  semantic-release:config      [AsyncFunction],
  semantic-release:config      [AsyncFunction],
  semantic-release:config      [AsyncFunction],
  semantic-release:config      [AsyncFunction],
  semantic-release:config      [AsyncFunction],
  semantic-release:config      [AsyncFunction],
  semantic-release:config      [AsyncFunction],
  semantic-release:config      [AsyncFunction],
  semantic-release:config      [AsyncFunction] ],
  semantic-release:config   _: [],
  semantic-release:config   e: [ 'semantic-release-monorepo' ],
  semantic-release:config   'verify-conditions': [],
  semantic-release:config   verifyConditions: [],
  semantic-release:config   'dry-run': true,
  semantic-release:config   d: true,
  semantic-release:config   dryRun: true,
  semantic-release:config   debug: true,
  semantic-release:config   '$0': '../../node_modules/.bin/semantic-release' } +0ms
[4:12:51 PM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/npm"
[4:12:51 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
[4:12:51 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
[4:12:51 PM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
[4:12:51 PM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[4:12:51 PM] [semantic-release] › ✔  Run automated release from branch poc/semantic-release-monorepo
[4:12:58 PM] [semantic-release] › ✔  Allowed to push to the Git repository
  semantic-release:get-last-release found tags: [] +0ms
[4:12:59 PM] [semantic-release] › ℹ  No git tag version found
[4:12:59 PM] [semantic-release] › ℹ  No previous release found, retrieving all commits
[4:12:59 PM] [semantic-release] › ℹ  Found 19 commits since last release ...
[4:12:59 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "[Function: ]"
  semantic-release:monorepo Running 'analyzeCommits' version '6.1.1' +0ms
  semantic-release:monorepo Filter commits by package path: "packages/commons.cookie-domain" +0ms
  semantic-release:monorepo Including commit "feat(cookie-domain): transfer package files" because it modified package file "packages/commons.cookie-domain/.babelrc". +97ms
[4:12:59 PM] [semantic-release] [[Function: ]] › ℹ  Found 1 commits for package my-package since last release
[4:12:59 PM] [semantic-release] › ✖  Failed step "analyzeCommits" of plugin "[Function: ]"
[4:12:59 PM] [semantic-release] › ✖  An error occurred while running semantic-release: { TypeError: cb is not a function
    at module.exports (/Users/projects/commons/node_modules/@semantic-release/commit-analyzer/dist/index.js:29:3)
    at /Users/projects/commons/node_modules/semantic-release-monorepo/src/only-package-commits.js:83:10 pluginName: '[Function: ]' }
{ TypeError: cb is not a function
    at module.exports (/Users/projects/commons/node_modules/@semantic-release/commit-analyzer/dist/index.js:29:3)
    at /Users/projects/commons/node_modules/semantic-release-monorepo/src/only-package-commits.js:83:10 pluginName: '[Function: ]' }lerna ERR! exec Errored while executing 'npx --no-install semantic-release -e semantic-release-monorepo --verify-conditions --dry-run --debug' in 'my-package'
lerna ERR! execute callback with error
lerna ERR! Error: Command failed: npx --no-install semantic-release -e semantic-release-monorepo --verify-conditions --dry-run --debug
lerna ERR!     at Promise.all.then.arr (/Users/projects/commons/node_modules/execa/index.js:236:11)
{ Error: Command failed: npx --no-install semantic-release -e semantic-release-monorepo --verify-conditions --dry-run --debug
    at Promise.all.then.arr (/Users/projects/commons/node_modules/execa/index.js:236:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  code: 1,
  killed: false,
  stdout: null,
  stderr: null,
  failed: true,
  signal: null,
  cmd:
   'npx --no-install semantic-release -e semantic-release-monorepo --verify-conditions --dry-run --debug',
  timedOut: false,
  exitCode: 1 }

semantic-release on it's own seems to run fine, but commit analyzer breaks for some reason.

I'm using:

"semantic-release": "^15.9.14",
"semantic-release-monorepo": "^6.1.1"

For e.g. when running --analyze-commits I get:

The analyzeCommits plugin configuration (https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/plugins.md#analyzecommits-plugin) is required and must be a single plugin definition. A plugin definition is either a string or an object with a path property.

    Your configuration for the `analyzeCommits` plugin is ``.

{ AggregateError:
    SemanticReleaseError: The `analyzeCommits` plugin configuration is invalid.
        at module.exports (/Users/projects/commons/node_modules/semantic-release/lib/get-error.js:6:10)
        at Object.entries.reduce (/Users/projects/commons/node_modules/semantic-release/lib/plugins/index.js:28:23)
        at Array.reduce (<anonymous>)
        at module.exports (/Users/projects/commons/node_modules/semantic-release/lib/plugins/index.js:12:55)
        at module.exports (/Users/projects/commons/node_modules/semantic-release/lib/get-config.js:66:35)
    at module.exports (/Users/projects/commons/node_modules/semantic-release/lib/plugins/index.js:49:11)
    at module.exports (/Users/projects/commons/node_modules/semantic-release/lib/get-config.js:66:35)

Don't bump up version from the pakcage.json but just from 1.0.0

Here is my repo using the semantic-release-monorepo :https://github.com/arvinxx/commit-gitmoji

I meet a problem that when I add a fix commit and trigger the release ci, semantic-release just bump up version from 1.0.0 other than from version from my package.json .

Because I have release some packages to npm. It will be a huge trouble to bump vesion manually.(for example, add two empty useless feat commits to get 1.2.0)

Is there any solution to this problem? thanks!

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

How to use this package with bitbucket and a private registry?

Hi, thanks for the package!

I'd like to use it with a bitbucket repository and a private artifactory registry but I'm not quite sure how the configuration should look like, may you help me please?

So far I'm stuck with this configuration:

  "release": {
    "monorepo": {
      "analyzeCommits": {
        "format": "angular"
      }
    },
    "publish": [
      "@semantic-release/git"
    ]
  },

(I removed the npm publisher for test purposes)

The error I get is:

[Semantic release]: EPLUGIN A plugin configured in the step publish is not a valid semantic-release plugin.
A valid publish semantic-release plugin must be a function or an object with a function in the property publish.

The plugin @semantic-release/git doesn't have the property publish and cannot be used for the publish step.

Please refer to the @semantic-release/git and semantic-release plugins configuration (https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/plugins.md) documentation for more details.

I installed "@semantic-release/git": "^4.0.2", "semantic-release": "^15.1.7" and "semantic-release-monorepo": "^6.0.1"

Issue encountered with "ENOGITHEAD There is no commit associated with last release"

Hi there! 👋 love this project! Unfortunately, ran into an issue when trying to do the following command in a lerna-based project, specifically:

$(yarn bin)/lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo

When running in debug mode, the output looks great until we get to semantic-release:npm which is trying to find v1.0.0 of a specific package. However, instead of finding <packageName>-v1.0.0 it's reporting the following:

[Semantic release]: Found version 1.0.0 of package @spec/babel-preset-spec with dist-tag latest
  semantic-release:npm Error: Command failed: git rev-list -1 v1.0.0
  semantic-release:npm fatal: ambiguous argument 'v1.0.0': unknown revision or path not in the working tree.

Here is the full debug information if that's helpful:

Semantic Release Debug
$ $(yarn bin)/lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo --debug                                                                             3.33s
lerna info version 2.7.0
lerna info versioning independent
[Semantic release]: This run was not triggered in a known CI environment, running in dry-run mode.
  semantic-release:get-version-head Check if the current working directory is a git repository +0ms
  semantic-release:get-version-head cmd: 'git rev-parse --git-dir' +0ms
  semantic-release:get-version-head stdout: '/Users/joshuablack/oss/spec/.git' +1ms
  semantic-release:get-version-head stderr: '' +0ms
  semantic-release:get-version-head code: 0 +0ms
  semantic-release:config options values: [ 'branch',
  semantic-release:config   'repositoryUrl',
  semantic-release:config   'analyzeCommits',
  semantic-release:config   'generateNotes',
  semantic-release:config   'getLastRelease',
  semantic-release:config   'publish',
  semantic-release:config   'ci',
  semantic-release:config   'debug',
  semantic-release:config   'dryRun' ] +0ms
  semantic-release:config name: undefined +0ms
  semantic-release:config branch: 'master' +0ms
  semantic-release:config repositoryUrl: 'https://github.com/joshblack/spec/tree/master/packages/babel-preset-spec' +0ms
  semantic-release:config analyzeCommits: [AsyncFunction] +0ms
  semantic-release:config generateNotes: [AsyncFunction] +1ms
  semantic-release:config verifyConditions: undefined +0ms
  semantic-release:config verifyRelease: undefined +0ms
  semantic-release:config publish: [ [AsyncFunction],
  semantic-release:config   [AsyncFunction],
  semantic-release:config   [AsyncFunction],
  semantic-release:config   [AsyncFunction],
  semantic-release:config   [AsyncFunction],
  semantic-release:config   [AsyncFunction],
  semantic-release:config   [AsyncFunction],
  semantic-release:config   [AsyncFunction],
  semantic-release:config   [AsyncFunction],
  semantic-release:config   [AsyncFunction] ] +0ms
[Semantic release]: Load plugin verifyConditions from @semantic-release/npm
[Semantic release]: Load plugin verifyConditions from @semantic-release/github
[Semantic release]: Run automated release from branch master
[Semantic release]: Call plugin verify-conditions
[Semantic release]: Verify authentication for registry https://registry.npmjs.org/
[Semantic release]: Verify GitHub authentication
[Semantic release]: Call plugin get-last-release
  semantic-release:monorepo Running 'getLastRelease' version '4.2.0' +0ms
info attempt registry request try #1 at 10:16:53
http request GET https://registry.npmjs.org/@spec%2Fbabel-preset-spec
http 200 https://registry.npmjs.org/@spec%2Fbabel-preset-spec
[Semantic release]: Found version 1.0.0 of package @spec/babel-preset-spec with dist-tag latest
  semantic-release:npm Error: Command failed: git rev-list -1 v1.0.0
  semantic-release:npm fatal: ambiguous argument 'v1.0.0': unknown revision or path not in the working tree.
  semantic-release:npm Use '--' to separate paths from revisions, like this:
  semantic-release:npm 'git <command> [<revision>...] -- [<file>...]'
  semantic-release:npm
  semantic-release:npm
  semantic-release:npm     at makeError (/Users/joshuablack/oss/spec/node_modules/@semantic-release/npm/node_modules/execa/index.js:169:9)
  semantic-release:npm     at Promise.all.then.arr (/Users/joshuablack/oss/spec/node_modules/@semantic-release/npm/node_modules/execa/index.js:274:16)
  semantic-release:npm     at <anonymous>
  semantic-release:npm     at process._tickCallback (internal/process/next_tick.js:160:7) +0ms
  semantic-release:npm Error: Command failed: git rev-list -1 1.0.0
  semantic-release:npm fatal: ambiguous argument '1.0.0': unknown revision or path not in the working tree.
  semantic-release:npm Use '--' to separate paths from revisions, like this:
  semantic-release:npm 'git <command> [<revision>...] -- [<file>...]'
  semantic-release:npm
  semantic-release:npm
  semantic-release:npm     at makeError (/Users/joshuablack/oss/spec/node_modules/@semantic-release/npm/node_modules/execa/index.js:169:9)
  semantic-release:npm     at Promise.all.then.arr (/Users/joshuablack/oss/spec/node_modules/@semantic-release/npm/node_modules/execa/index.js:274:16)
  semantic-release:npm     at <anonymous>
  semantic-release:npm     at process._tickCallback (internal/process/next_tick.js:160:7) +6ms
  semantic-release:npm Error: Command failed: git rev-list -1 v1.0.0
  semantic-release:npm fatal: ambiguous argument 'v1.0.0': unknown revision or path not in the working tree.
  semantic-release:npm Use '--' to separate paths from revisions, like this:
  semantic-release:npm 'git <command> [<revision>...] -- [<file>...]'
  semantic-release:npm
  semantic-release:npm
  semantic-release:npm     at makeError (/Users/joshuablack/oss/spec/node_modules/@semantic-release/npm/node_modules/execa/index.js:169:9)
  semantic-release:npm     at Promise.all.then.arr (/Users/joshuablack/oss/spec/node_modules/@semantic-release/npm/node_modules/execa/index.js:274:16)
  semantic-release:npm     at <anonymous>
  semantic-release:npm     at process._tickCallback (internal/process/next_tick.js:160:7) +14ms
  semantic-release:npm Error: Command failed: git rev-list -1 1.0.0
  semantic-release:npm fatal: ambiguous argument '1.0.0': unknown revision or path not in the working tree.
  semantic-release:npm Use '--' to separate paths from revisions, like this:
  semantic-release:npm 'git <command> [<revision>...] -- [<file>...]'
  semantic-release:npm
  semantic-release:npm
  semantic-release:npm     at makeError (/Users/joshuablack/oss/spec/node_modules/@semantic-release/npm/node_modules/execa/index.js:169:9)
  semantic-release:npm     at Promise.all.then.arr (/Users/joshuablack/oss/spec/node_modules/@semantic-release/npm/node_modules/execa/index.js:274:16)
  semantic-release:npm     at <anonymous>
  semantic-release:npm     at process._tickCallback (internal/process/next_tick.js:160:7) +6ms
[Semantic release]: The commit the last release of this package was derived from cannot be determined from the release metadata nor from the repository tags.
This means semantic-release can not extract the commits between now and then.
This is usually caused by releasing from outside the repository directory or with innaccessible git metadata.

You can recover from this error by creating a tag for the version "1.0.0" on the commit corresponding to this release:
$ git tag -f v1.0.0 <commit sha1 corresponding to last release>
$ git push -f --tags origin master

[Semantic release]: ENOGITHEAD There is no commit associated with last release
lerna ERR! exec Errored while executing 'semantic-release -e semantic-release-monorepo --debug' in '@spec/babel-preset-spec'
lerna ERR! execute callback with error
lerna ERR! Error: Command failed: semantic-release -e semantic-release-monorepo --debug
lerna ERR!     at Promise.all.then.arr (/Users/joshuablack/oss/spec/node_modules/execa/index.js:236:11)
lerna ERR!     at <anonymous>
{ Error: Command failed: semantic-release -e semantic-release-monorepo --debug
    at Promise.all.then.arr (/Users/joshuablack/oss/spec/node_modules/execa/index.js:236:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
  code: 1,
  killed: false,
  stdout: null,
  stderr: null,
  failed: true,
  signal: null,
  cmd: 'semantic-release -e semantic-release-monorepo --debug',
  timedOut: false,
  exitCode: 1

And below are the following relevant package versions as well:

{
    "lerna": "^2.7.0",
    "semantic-release": "^12.2.2",
    "semantic-release-monorepo": "^4.2.0"
}

Was hopeful that you all could steer me in the right direction here to figure out what's going on. Thanks again for this project! Can't wait to get it working again 😄

Bumping cross package versions

Hey, thanks for such handy extension! I've noticed that release doesn't bump cross-dependent packages in monorepo. Do you think it's possible to achieve with root-level hook in any way? Thanks.

create a prerelease of one package with monorepo?

Is there a way to create a prelease version of a specific package with monorepo?

I'd like to run semantic-release to release one of my packages on a branch where we're building our next release version.

Does anyone have an example of doing this?

note: I'm aware of version 16x of semantic-release but so far it's been buggy and I haven't been able to get the latest version to do what I want - so specifically looking for 15x solutions please.

thank you!

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

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
  }

Implementation on Azure Devops pipeline

I really like the idea behind this solution and would like to implement it as part of our CD process in Azure pipeline.
Unfortunately, I couldn't find any explanation about how to do it.

The root directory of the repository contains:

  • ProjectA folder
  • ProjectB folder
  • releaserc.js configuration file.

Is the structure and and the position of releaserc.js file are correct?
How that bash scripts within the CD pipeline should be look like?
Thanks.

semantic release 16 support

Hi,
I just wanted to ask if this package will get semantic release 16 support. Which will add support for prelease and bugfix releases on different branches. Which will most likely not work out of the box with monorepos.
Do you need any help with doing so?

Need help to find correct configuration for monorepo project.

Hi @pmowrer, @alisd23,

I am unable to find out correct configuration to publish(to artifactory) only those components where file is modified.

Below is the command executed after I change any src file of component:
git add .
git cz (commitzen)

Below is the command I execute for testing, building and publishing component:

npm install
node_modules/.bin/ng lint component1 --force=true --format=json > component1_lint-out.json
node_modules/.bin/ng test component1 --code-coverage --browsers ChromeHeadless
node_modules/.bin/ng lint component2 --force=true --format=json > component2_lint-out.json
node_modules/.bin/ng test component2 --code-coverage --browsers ChromeHeadless
node_modules/.bin/ng lint component3 --force=true --format=json > component3_lint-out.json
node_modules/.bin/ng test component3 --code-coverage --browsers ChromeHeadless
node_modules/.bin/ng build component1
node_modules/.bin/ng build component2
node_modules/.bin/ng build component3
npx semantic-release -e semantic-release-monorepo

here only component1 gets published to JFrog Artifactory

Here I wanted to avoid building each component, and instead of that have config in root package.json to achieve that.

I have following monorepo project structure:

master-project(Project root)

|_-> apps
|_-> e2e
|_-> libs
|_-> projects
       |_-> component1 -> package.json
       |_-> component2 -> package.json
       |_-> component3 -> package.json
|_-> package.json

project root package.json content:

{
	"name": "master-project",
	"version": "0.0.0-semantically-released",
	"scripts": {
		"ng": "ng",
		"start": "ng serve",
		"build": "ng build",
		"test": "ng test",
		"lint": "ng lint",
		"e2e": "ng e2e"
	},
	"private": false,
	"dependencies": {
		"@angular/animations": "^6.1.0",
		"@angular/common": "^6.1.0",
		"@angular/compiler": "^6.1.0",
		"@angular/core": "^6.1.0",
		"@angular/forms": "^6.1.0",
		"@angular/http": "^6.1.0",
		"@angular/platform-browser": "^6.1.0",
		"@angular/platform-browser-dynamic": "^6.1.0",
		"@angular/router": "^6.1.0",
		"core-js": "^2.5.4",
		"rxjs": "^6.0.0"
	},
	"devDependencies": {
		"@angular-devkit/build-angular": "~0.7.0",
		"@angular-devkit/build-ng-packagr": "~0.7.0",
		"@angular/cli": "~6.1.1",
		"@angular/compiler-cli": "^6.1.0",
		"@angular/language-service": "^6.1.0",
		"@semantic-release/changelog": "github:semantic-release/changelog",
		"@types/jasmine": "~2.8.6",
		"@types/jasminewd2": "~2.0.3",
		"@types/node": "~8.9.4",
		"codelyzer": "~4.2.1",
		"cz-conventional-changelog": "^2.1.0",
		"jasmine-core": "~2.99.1",
		"jasmine-spec-reporter": "~4.2.1",
		"karma": "~1.7.1",
		"karma-chrome-launcher": "~2.2.0",
		"karma-coverage-istanbul-reporter": "^2.0.0",
		"karma-jasmine": "~1.1.1",
		"karma-jasmine-html-reporter": "^0.2.2",
		"karma-sonarqube-reporter": "^1.0.4",
		"ng-packagr": "^3.0.0",
		"protractor": "~5.3.0",
		"semantic-release": "^15.9.16",
		"semantic-release-gerrit": "^1.1.4",
		"semantic-release-monorepo": "^6.1.1",
		"ts-node": "~5.0.1"
	},
	"config": {
		"commitizen": {
			"path": "./node_modules/cz-conventional-changelog"
		}
	},
	"release": {
		"monorepo": {
			"analyzeCommits": "@semantic-release/commit-analyzer",
			"generateNotes": [{
				"path": "semantic-release-gerrit",
				"gerritUrl": "https://gerrit.com/#/admin/projects/master-project"
			}]
		},
		"verifyConditions": "@semantic-release/npm",
		"analyzeCommits": "@semantic-release/commit-analyzer",
		"generateNotes": [{
			"path": "semantic-release-gerrit",
			"gerritUrl": "https://gerrit.com/#/admin/projects/master-project"
		}],
		"prepare": [{
				"path": "@semantic-release/changelog",
				"changelogFile": "docs/changelog.md"
			},
			"@semantic-release/npm"
		],
		"publish": "@semantic-release/npm",
		"success": false,
		"fail": false,
		"pkgRoot": "./dist/component1/",
		"npmPublish": true,
		"tarballDir": "dist",
		"branch": "master"
	},
	"repository": {
		"type": "git",
		"url": "https://gerrit.com/a/master-project.git"
	}
}

component1 package.json content:

{
  "name": "component1",
  "version": "0.0.1-semantically-released",
  "peerDependencies": {
    "@angular/common": "^6.0.0-rc.0 || ^6.0.0",
    "@angular/core": "^6.0.0-rc.0 || ^6.0.0"
  }
}

I know "pkgRoot": "./dist/component1/" is the one which is causing only component1 to publish. But if I try
"pkgRoot": ["./dist/component1/", "./dist/component2/", "./dist/component3/"] it is throwing error.

Please suggest on how to achieve:

  1. Publish only those component where actully file got changed.
  2. Version bump (minor or major or patch) only for specific component where file got changed.

Help wanted!

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

[TIP] running with YARN from root

Figured someone could use this info.

You can run semantic-release from the repo root if you do the following.

  1. Put a .yarnrc file inside the library folder that point to the root node_modules. So if I have libs/mylib then
// .yarnrc
--run.modules-folder ../../node_modules
  1. In the root package.json script use --cwd libs/mylib
// root package.json, not the library
{
  "scripts": {
    "mylib:semantic-release": "yarn --cwd libs/mylib run semantic-release -e semantic-release-monorepo"
  }
}
  1. ???
  2. Profit

Found 0 commits for package

Hi there and thanks for this package! I have a problem when we merge a PR to the master branch with updates to the @ibmscope/icons package. The Travis build will immediately make a GitHub tag with the new version number. However, we get no GitHub nor NPM release.

I have the current setup in each of our monorepo’s packages:

"release": {
    "monorepo": {
      "analyzeCommits": {
        "format": "angular",
        "releaseRules": "../../utils/release.js"
      },
      "generateNotes": {
        "preset": "angular"
      }
    },
    "branch": "master",
    "githubUrl": "https://github.ibm.com",
    "githubApiPathPrefix": "api/v3"
  }

release.js (used until we hit v1.0.0 for the packages):

module.exports = [
  { breaking: true, release: 'minor' },
  { type: 'feat', release: 'patch' },
  { type: 'fix', release: 'patch' },
  { type: 'perf', release: 'patch' },
  { type: 'docs', release: 'patch' },
  { type: 'chore', release: 'patch' },
  { type: 'style', release: 'patch' },
  { type: 'refactor', release: 'patch' },
];

Travis logs:

$ yarn semantic-release
yarn run v1.5.1
$ lerna exec yarn semantic-release
lerna info version 2.10.2
lerna info versioning independent
$ semantic-release --debug -e semantic-release-monorepo
$ semantic-release --debug -e semantic-release-monorepo
$ semantic-release --debug -e semantic-release-monorepo
$ semantic-release --debug -e semantic-release-monorepo
[Semantic release]: Running semantic-release version 15.1.7
[Semantic release]: Running semantic-release version 15.1.7
[Semantic release]: Running semantic-release version 15.1.7
[Semantic release]: Running semantic-release version 15.1.7
  semantic-release:config options values: { branch: 'master',
  semantic-release:config   repositoryUrl: '[email protected]:scope/styles.git',
  semantic-release:config   tagFormat: '@ibmscope/icons-v${version}',
  semantic-release:config   analyzeCommits: [AsyncFunction],
  semantic-release:config   generateNotes: [AsyncFunction],
  semantic-release:config   monorepo: 
  semantic-release:config    { analyzeCommits: { format: 'angular', releaseRules: '../../utils/releases' },
  semantic-release:config      generateNotes: { preset: 'angular' } },
  semantic-release:config   githubUrl: 'https://github.ibm.com',
  semantic-release:config   githubApiPathPrefix: 'api/v3',
  semantic-release:config   _: [],
  semantic-release:config   debug: [secure],
  semantic-release:config   e: [ 'semantic-release-monorepo' ],
  semantic-release:config   '$0': 'node_modules/.bin/semantic-release' } +0ms
[Semantic release]: Load plugin verifyConditions from @semantic-release/npm
  semantic-release:config options values: { branch: 'master',
  semantic-release:config   repositoryUrl: '[email protected]:scope/styles.git',
  semantic-release:config   tagFormat: '@ibmscope/type-v${version}',
  semantic-release:config   analyzeCommits: [AsyncFunction],
  semantic-release:config   generateNotes: [AsyncFunction],
  semantic-release:config   monorepo: 
  semantic-release:config    { analyzeCommits: { format: 'angular' },
  semantic-release:config      generateNotes: { preset: 'angular', releaseRules: '../../utils/releases' } },
  semantic-release:config   githubUrl: 'https://github.ibm.com',
  semantic-release:config   githubApiPathPrefix: 'api/v3',
  semantic-release:config   _: [],
  semantic-release:config   debug: [secure],
  semantic-release:config   e: [ 'semantic-release-monorepo' ],
  semantic-release:config   '$0': 'node_modules/.bin/semantic-release' } +0ms
[Semantic release]: Load plugin verifyConditions from @semantic-release/npm
[Semantic release]: Load plugin verifyConditions from @semantic-release/github
  semantic-release:config options values: { branch: 'master',
  semantic-release:config   repositoryUrl: '[email protected]:scope/styles.git',
  semantic-release:config   tagFormat: '@ibmscope/colors-v${version}',
  semantic-release:config   analyzeCommits: [AsyncFunction],
  semantic-release:config   generateNotes: [AsyncFunction],
  semantic-release:config   monorepo: 
  semantic-release:config    { analyzeCommits: { format: 'angular', releaseRules: '../../utils/releases' },
  semantic-release:config      generateNotes: { preset: 'angular' } },
  semantic-release:config   githubUrl: 'https://github.ibm.com',
  semantic-release:config   githubApiPathPrefix: 'api/v3',
  semantic-release:config   _: [],
  semantic-release:config   debug: [secure],
  semantic-release:config   e: [ 'semantic-release-monorepo' ],
  semantic-release:config   '$0': 'node_modules/.bin/semantic-release' } +0ms
[Semantic release]: Load plugin verifyConditions from @semantic-release/npm
[Semantic release]: Load plugin verifyConditions from @semantic-release/github
[Semantic release]: Load plugin verifyConditions from @semantic-release/github
  semantic-release:config options values: { branch: 'master',
  semantic-release:config   repositoryUrl: '[email protected]:scope/styles.git',
  semantic-release:config   tagFormat: '@ibmscope/grid-v${version}',
  semantic-release:config   analyzeCommits: [AsyncFunction],
  semantic-release:config   generateNotes: [AsyncFunction],
  semantic-release:config   monorepo: 
  semantic-release:config    { analyzeCommits: { format: 'angular', releaseRules: '../../utils/releases' },
  semantic-release:config      generateNotes: { preset: 'angular' } },
  semantic-release:config   githubUrl: 'https://github.ibm.com',
  semantic-release:config   githubApiPathPrefix: 'api/v3',
  semantic-release:config   _: [],
  semantic-release:config   debug: [secure],
  semantic-release:config   e: [ 'semantic-release-monorepo' ],
  semantic-release:config   '$0': 'node_modules/.bin/semantic-release' } +0ms
[Semantic release]: Load plugin verifyConditions from @semantic-release/npm
[Semantic release]: Load plugin verifyConditions from @semantic-release/github
[Semantic release]: Load plugin prepare from @semantic-release/npm
[Semantic release]: Load plugin publish from @semantic-release/npm
[Semantic release]: Load plugin publish from @semantic-release/github
[Semantic release]: Load plugin success from @semantic-release/github
[Semantic release]: Load plugin fail from @semantic-release/github
[Semantic release]: Load plugin prepare from @semantic-release/npm
[Semantic release]: Load plugin publish from @semantic-release/npm
[Semantic release]: Load plugin publish from @semantic-release/github
[Semantic release]: Load plugin success from @semantic-release/github
[Semantic release]: Load plugin fail from @semantic-release/github
[Semantic release]: Load plugin prepare from @semantic-release/npm
[Semantic release]: Load plugin publish from @semantic-release/npm
[Semantic release]: Load plugin publish from @semantic-release/github
[Semantic release]: Load plugin success from @semantic-release/github
[Semantic release]: Load plugin fail from @semantic-release/github
[Semantic release]: Load plugin prepare from @semantic-release/npm
[Semantic release]: Load plugin publish from @semantic-release/npm
[Semantic release]: Load plugin publish from @semantic-release/github
[Semantic release]: Load plugin success from @semantic-release/github
[Semantic release]: Load plugin fail from @semantic-release/github
[Semantic release]: Run automated release from branch master
[Semantic release]: Call plugin verify-conditions
[Semantic release]: Verify authentication for registry https://na.artifactory.swg-devops.com/artifactory/api/npm/hyc-ibmscope-npm-virtual/
[Semantic release]: Verify GitHub authentication (https://github.ibm.com/api/v3)
[Semantic release]: Run automated release from branch master
[Semantic release]: Call plugin verify-conditions
[Semantic release]: Verify authentication for registry https://na.artifactory.swg-devops.com/artifactory/api/npm/hyc-ibmscope-npm-virtual/
[Semantic release]: Verify GitHub authentication (https://github.ibm.com/api/v3)
[Semantic release]: Run automated release from branch master
[Semantic release]: Call plugin verify-conditions
[Semantic release]: Verify authentication for registry https://na.artifactory.swg-devops.com/artifactory/api/npm/hyc-ibmscope-npm-virtual/
[Semantic release]: Run automated release from branch master
[Semantic release]: Call plugin verify-conditions
[Semantic release]: Verify authentication for registry https://na.artifactory.swg-devops.com/artifactory/api/npm/hyc-ibmscope-npm-virtual/
[Semantic release]: Verify GitHub authentication (https://github.ibm.com/api/v3)
[Semantic release]: Verify GitHub authentication (https://github.ibm.com/api/v3)
  semantic-release:get-last-release found tags: [ { gitTag: '@ibmscope/type-v0.7.4', version: '0.7.4' } ] +0ms
[Semantic release]: Found git tag @ibmscope/type-v0.7.4 associated with version 0.7.4
  semantic-release:get-commits Use gitHead: 01c4fe8a5533240aa01735b73961c0f55df37a87 +0ms
[Semantic release]: Found 1 commits since last release
  semantic-release:get-commits Parsed commits: [ { commit: { long: '7a136fae8be0fe81df17e045d47a1489f40d0d09', short: '7a136fa' }, tree: { long: '042de1e35343b37eed8da8f2afe6beea0f15ac66', short: '042de1e' }, author: { name: 'Trevor J. Wong', email: '[email protected]', date: 2018-04-24T22:01:31.000Z }, committer: { name: 'James Y. Rauhut', email: '[email protected]', date: 2018-04-24T22:01:31.000Z }, subject: 'feat(icons): added new and missing icons (#41)', body: '* feat(icons): added new and missing icons\r\n\r\n* fix(icons): rename export to export-file to avoid naming collision\r\n\r\n* fix(colors): update colors gulp version to reflect other packages\r\n\r\n* fix(travis): added all scoped packages to travis.yml\r\n', hash: '7a136fae8be0fe81df17e045d47a1489f40d0d09', message: 'feat(icons): added new and missing icons (#41)\n\n* feat(icons): added new and missing icons\r\n\r\n* fix(icons): rename export to export-file to avoid naming collision\r\n\r\n* fix(colors): update colors gulp version to reflect other packages\r\n\r\n* fix(travis): added all scoped packages to travis.yml', gitTags: '(HEAD, tag: @ibmscope/icons-v0.2.10, tag: @ibmscope/colors-v0.1.19, origin/master, origin/HEAD, master)', committerDate: 2018-04-24T22:01:31.000Z } ] +16ms
[Semantic release]: Call plugin analyze-commits
  semantic-release:monorepo Running 'analyzeCommits' version '6.0.1' +0ms
  semantic-release:monorepo Filter commits by package path: "packages/type" +0ms
  semantic-release:get-last-release found tags: [ { gitTag: '@ibmscope/colors-v0.1.19', version: '0.1.19' }, { gitTag: '@ibmscope/colors-v0.1.18', version: '0.1.18' } ] +0ms
[Semantic release]: Found 0 commits for package @ibmscope/type since last release
[Semantic release]: Analysis of 0 commits complete: no release
[Semantic release]: There are no relevant changes, so no new version is released.
  semantic-release:get-last-release found tags: [ { gitTag: '@ibmscope/icons-v0.2.10', version: '0.2.10' }, { gitTag: '@ibmscope/icons-v0.2.9', version: '0.2.9' } ] +0ms
[Semantic release]: Found git tag @ibmscope/colors-v0.1.19 associated with version 0.1.19
  semantic-release:get-commits Use gitHead: 7a136fae8be0fe81df17e045d47a1489f40d0d09 +0ms
[Semantic release]: Found git tag @ibmscope/icons-v0.2.10 associated with version 0.2.10
[Semantic release]: Found 0 commits since last release
  semantic-release:get-commits Parsed commits: [] +18ms
[Semantic release]: Call plugin analyze-commits
  semantic-release:get-commits Use gitHead: 7a136fae8be0fe81df17e045d47a1489f40d0d09 +0ms
  semantic-release:get-last-release found tags: [ { gitTag: '@ibmscope/grid-v0.5.11', version: '0.5.11' } ] +0ms
[Semantic release]: Found 0 commits since last release
  semantic-release:get-commits Parsed commits: [] +34ms
[Semantic release]: Call plugin analyze-commits
[Semantic release]: Found git tag @ibmscope/grid-v0.5.11 associated with version 0.5.11
  semantic-release:get-commits Use gitHead: 01c4fe8a5533240aa01735b73961c0f55df37a87 +0ms
  semantic-release:monorepo Running 'analyzeCommits' version '6.0.1' +0ms
[Semantic release]: Found 1 commits since last release
  semantic-release:get-commits Parsed commits: [ { commit: { long: '7a136fae8be0fe81df17e045d47a1489f40d0d09', short: '7a136fa' }, tree: { long: '042de1e35343b37eed8da8f2afe6beea0f15ac66', short: '042de1e' }, author: { name: 'Trevor J. Wong', email: '[email protected]', date: 2018-04-24T22:01:31.000Z }, committer: { name: 'James Y. Rauhut', email: '[email protected]', date: 2018-04-24T22:01:31.000Z }, subject: 'feat(icons): added new and missing icons (#41)', body: '* feat(icons): added new and missing icons\r\n\r\n* fix(icons): rename export to export-file to avoid naming collision\r\n\r\n* fix(colors): update colors gulp version to reflect other packages\r\n\r\n* fix(travis): added all scoped packages to travis.yml\r\n', hash: '7a136fae8be0fe81df17e045d47a1489f40d0d09', message: 'feat(icons): added new and missing icons (#41)\n\n* feat(icons): added new and missing icons\r\n\r\n* fix(icons): rename export to export-file to avoid naming collision\r\n\r\n* fix(colors): update colors gulp version to reflect other packages\r\n\r\n* fix(travis): added all scoped packages to travis.yml', gitTags: '(HEAD, tag: @ibmscope/icons-v0.2.10, tag: @ibmscope/colors-v0.1.19, origin/master, origin/HEAD, master)', committerDate: 2018-04-24T22:01:31.000Z } ] +41ms
[Semantic release]: Call plugin analyze-commits
  semantic-release:monorepo Filter commits by package path: "packages/colors" +0ms
  semantic-release:monorepo Running 'analyzeCommits' version '6.0.1' +0ms
[Semantic release]: Found 0 commits for package @ibmscope/colors since last release
[Semantic release]: Analysis of 0 commits complete: no release
[Semantic release]: There are no relevant changes, so no new version is released.
  semantic-release:monorepo Running 'analyzeCommits' version '6.0.1' +0ms
  semantic-release:monorepo Filter commits by package path: "packages/icons" +0ms
  semantic-release:monorepo Filter commits by package path: "packages/grid" +0ms
[Semantic release]: Found 0 commits for package @ibmscope/icons since last release
[Semantic release]: Analysis of 0 commits complete: no release
[Semantic release]: There are no relevant changes, so no new version is released.
[Semantic release]: Found 0 commits for package @ibmscope/grid since last release
[Semantic release]: Analysis of 0 commits complete: no release
[Semantic release]: There are no relevant changes, so no new version is released.
Done in 7.06s.

Log looks weird

[11:50:21 PM] [semantic-release] [[Function: semantic-release-monorepo]] » i  Found 1 commits for package node-package-starter-subpackage since last release
[11:50:21 PM] [semantic-release] [[Function: semantic-release-monorepo]] » i  Analyzing commit: feat: subpackage
[11:50:21 PM] [semantic-release] [[Function: semantic-release-monorepo]] » i  The release type for the commit is minor
[11:50:21 PM] [semantic-release] [[Function: semantic-release-monorepo]] » i  Analysis of 1 commits complete: minor release

semantic-release 17.0.4
semantic-release-monorepo 7.0.2

[Function: semantic-release-monorepo] looks weird

Customize generateNotes configuration

We are using semantic-release and semantic-release-monorepo in our project and want to modify the default conventional-changelog-angular writerOpts configuration (specifically the transform function).

Following the guidelines for semantic release, I added the function at the root of the config object and my changes were applied to the changelog notes in GH.

module.exports = {
  branches: ['master'],
  githubUrl: 'https://github.ibm.com',
  githubApiPathPrefix: 'api/v3',
  releaseRules: [...],
  generateNotes: {
    preset: 'angular',
    writerOpts: {
      transform: (commit, context) => {...},
    }
  },
  releaseNotes: {
    issueResolution: {
      template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
      baseUrl: 'https://github.ibm.com',
      source: 'github.ibm.com',
    },
  },
}

However, with this approach we lost the commit package scoping that is provided by semantic-release-monorepo.

In a different project we use semantic-release-gitmoji as our changelog convention and were able to set it up to work with semantic-release-monorepo by doing the following:

module.exports = {
  monorepo: {
    analyzeCommits: 'semantic-release-gitmoji',
    generateNotes: 'semantic-release-gitmoji',
  },
  branches: ['develop'],
  githubUrl: 'https://github.ibm.com',
  githubApiPathPrefix: 'api/v3',
  releaseRules,
  releaseNotes: {
    template,
    partials: {
      commitTemplate,
      emojiCommitsTemplate,
    },
    issueResolution: {
      template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
      baseUrl: 'https://github.ibm.com',
      source: 'github.ibm.com',
    },
  },
};

I tried to do something similar in my current project:

module.exports = {
  monorepo: {
    generateNotes: {
      preset: 'angular',
      writerOpts: {
        transform: (commit, context) => {...},
      }
    },
  },
  branches: ['master'],
  githubUrl: 'https://github.ibm.com',
  githubApiPathPrefix: 'api/v3',
  releaseRules: [...],
  releaseNotes: {
    issueResolution: {
      template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
      baseUrl: 'https://github.ibm.com',
      source: 'github.ibm.com',
    },
  },
}

but did not have any luck as it reverted back to using the default transform function

Debug with generateNotes in monorepo:

options values: { branches:
  [ 'master',
    { name: 'staging', prerelease: true } ],
 repositoryUrl: '[email protected]:liz-judd/semantic-release-testing.git',
 tagFormat: '@whpal/liz-semrel-testing-utilities-v${version}',
 plugins:
  [ '@semantic-release/commit-analyzer',
    '@semantic-release/release-notes-generator',
    '@semantic-release/npm',
    '@semantic-release/github' ],
 analyzeCommits:
  [ [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction] ],
 generateNotes:
  [ [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction] ],
 monorepo:
  { generateNotes: { preset: 'angular', writerOpts: [Object] } },
 githubUrl: 'https://github.ibm.com',
 githubApiPathPrefix: 'api/v3',
 releaseRules:  [ ... ],
 releaseNotes:
  { issueResolution:
     { template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
       baseUrl: 'https://github.ibm.com',
       source: 'github.ibm.com' } },
 }

Debug with generateNotes at root:

options values: { branches:
  [ 'master',
    { name: 'staging', prerelease: true } ],
 repositoryUrl: '[email protected]:liz-judd/semantic-release-testing.git',
 tagFormat: '@whpal/liz-semrel-testing-utilities-v${version}',
 plugins:
  [ '@semantic-release/commit-analyzer',
    '@semantic-release/release-notes-generator',
    '@semantic-release/npm',
    '@semantic-release/github' ],
 analyzeCommits:
  [ [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction],
    [AsyncFunction] ],
 generateNotes:
  { preset: 'angular',
    writerOpts: { transform: [Function: transform] } },
 githubUrl: 'https://github.ibm.com',
 githubApiPathPrefix: 'api/v3',
 releaseRules: [...],
 releaseNotes:
  { issueResolution:
     { template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
       baseUrl: 'https://github.ibm.com',
       source: 'github.ibm.com' } },
}

Fixing previously unconventional version

I tried to migrate my repo to using semantic-release-monorepo from just autopublish. However since previously the packages were commited manually, I need to fix the tags to match the HEAD commit. However not really sure what tag name should i push to fix each package?

Would be grateful if given an example!

EAGAIN exception when analysing many commits

Comparing commits since last release throws an EAGAIN exception on ~1400 or more commits. This is due to the maximum concurrent process limit.

Stack trace:

[Semantic release]: Found 2436 commits since last release
[Semantic release]: Call plugin analyze-commits
[Semantic release]: An error occurred while running semantic-release: { Error: spawn git EAGAIN
    at _errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  code: 'EAGAIN',
  errno: 'EAGAIN',
  syscall: 'spawn git',
  path: 'git',
  spawnargs:
   [ 'diff-tree',
     '--no-commit-id',
     '--name-only',
     '-r',
     '<REDACTED>' ],
  killed: false,
  stdout: null,
  stderr: null,
  failed: true,
  signal: null,
  cmd: 'git diff-tree --no-commit-id --name-only -r <REDACTED>',
  timedOut: false,
  pluginName: '[Function: ]' }```

semantic-release 15.9.x -> 15.10.x seem to be breaking this plugin

I'll try to take a look myself time permitting, but wanted to let you know.
Logs attached:

$ lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo
lerna notice cli v3.4.3
lerna info versioning independent
lerna info Executing command in 1 package: "semantic-release -e semantic-release-monorepo"
[3:08:28 AM] [semantic-release] › ℹ  Running semantic-release version 15.10.3
[3:08:28 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[3:08:28 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/npm"
[3:08:28 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
[3:08:28 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
[3:08:28 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
[3:08:28 AM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
[3:08:28 AM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[3:08:28 AM] [semantic-release] › ✔  Run automated release from branch master
[3:08:30 AM] [semantic-release] › ✔  Allowed to push to the Git repository
[3:08:31 AM] [semantic-release] › ℹ  Found git tag @microfleet/core-v13.0.2 associated with version 13.0.2
[3:08:31 AM] [semantic-release] › ℹ  Found 9 commits since last release
[3:08:31 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "[Function: ]"
[3:08:31 AM] [semantic-release] › ✖  Failed step "analyzeCommits" of plugin "[Function: ]"
[3:08:31 AM] [semantic-release] › ✖  An error occurred while running semantic-release: { TypeError: Expected `moduleId` to be of type `string`, got `object`
    at resolveFrom (/home/runner/core/node_modules/import-from/node_modules/resolve-from/index.js:11:9)
    at module.exports (/home/runner/core/node_modules/import-from/node_modules/resolve-from/index.js:34:41)
    at module.exports (/home/runner/core/node_modules/import-from/index.js:4:49)
    at requirePlugin (/home/runner/core/node_modules/semantic-release-plugin-decorators/src/index.js:4:33)
    at resolvePluginFn (/home/runner/core/node_modules/semantic-release-plugin-decorators/src/index.js:18:18)
    at /home/runner/core/node_modules/semantic-release-plugin-decorators/src/index.js:26:20
    at validator (/home/runner/core/node_modules/semantic-release/lib/plugins/normalize.js:30:28)
    at pReduce (/home/runner/core/node_modules/semantic-release/lib/plugins/pipeline.js:37:40)
    at Promise.all.then.value (/home/runner/core/node_modules/p-reduce/index.js:16:10)
    at process._tickCallback (internal/process/next_tick.js:68:7) pluginName: '[Function: ]' }
{ TypeError: Expected `moduleId` to be of type `string`, got `object`
    at resolveFrom (/home/runner/core/node_modules/import-from/node_modules/resolve-from/index.js:11:9)
    at module.exports (/home/runner/core/node_modules/import-from/node_modules/resolve-from/index.js:34:41)
    at module.exports (/home/runner/core/node_modules/import-from/index.js:4:49)
    at requirePlugin (/home/runner/core/node_modules/semantic-release-plugin-decorators/src/index.js:4:33)
    at resolvePluginFn (/home/runner/core/node_modules/semantic-release-plugin-decorators/src/index.js:18:18)
    at /home/runner/core/node_modules/semantic-release-plugin-decorators/src/index.js:26:20
    at validator (/home/runner/core/node_modules/semantic-release/lib/plugins/normalize.js:30:28)
    at pReduce (/home/runner/core/node_modules/semantic-release/lib/plugins/pipeline.js:37:40)
    at Promise.all.then.value (/home/runner/core/node_modules/p-reduce/index.js:16:10)
    at process._tickCallback (internal/process/next_tick.js:68:7) pluginName: '[Function: ]' }lerna ERR! semantic-release -e semantic-release-monorepo exited 1 in '@microfleet/core'
lerna ERR! semantic-release -e semantic-release-monorepo exited 1 in '@microfleet/core'

how to link packages which are semantically released?

@pmowrer how do you link packages that depend on other packages within the repo? I'm using something like this:

  "dependencies": {
    "@my/icons": "^0.0.0-semantically-released"
  }

but the issue is when I use the package, npm gracefully falls back says it can't find the version 0.0.0-semantically-released and then asks me to pick a version.

when using lerna publish the package.json will be modified to reflect the new version so it is handled, but since we're not using lerna publish to publish the package anymore, that hook is no longer an option.

generateNotes step failing

We've been using semantic-release-monorepo for a couple months using a lerna project. Been working great until recently this error pops up during generateNotes step:

[2:46:29 PM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "[Function: ]"
[2:46:29 PM] [semantic-release] › ✖  Failed step "generateNotes" of plugin "[Function: ]"
[2:46:29 PM] [semantic-release] › ✖  An error occurred while running semantic-release: { TypeError: Expected `moduleId` to be of type `string`, got `object`
    at resolveFrom (/node_modules/import-from/node_modules/resolve-from/index.js:11:9)
    at module.exports (/node_modules/import-from/node_modules/resolve-from/index.js:34:41)
    at module.exports (/node_modules/import-from/index.js:4:49)
    at requirePlugin (/node_modules/semantic-release-plugin-decorators/src/index.js:4:33)
    at resolvePluginFn (/node_modules/semantic-release-plugin-decorators/src/index.js:18:18)
    at /node_modules/semantic-release-plugin-decorators/src/index.js:26:20
    at validator (/node_modules/semantic-release/lib/plugins/normalize.js:34:28)
    at pReduce (/node_modules/semantic-release/lib/plugins/pipeline.js:37:40)
    at Promise.all.then.value (/node_modules/p-reduce/index.js:16:10)
    at process._tickCallback (internal/process/next_tick.js:68:7) pluginName: '[Function: ]' }

Seems to be some sort of issue with semantic-release-plugin-decorators, which uses import-from to load a plugin, and it's getting passed an object (I actually think its an array) instead of a string for moduleId which throws.

If I stop extending from semantic-release-monorepo, semantic-release runs fine (but obviously generates bad release notes, etc that aren't filtered by packages). Any ideas?

We did recently move repo to yarn, not sure if that could cause weirdness. (Update - tested w/ NPM and still seeing same issue....)

Also some info:
Tested both semantic-release versions 15.6 and 15.9
Node version 10.8.0 (also tested 10.6.0)

Here's some additional output showing difference between what gets passed for the analyzeCommits step vs. the generateNotes step: I'm logging the passed moduleId to the console. For analyzeCommits, we have a string, but for generateNotes we have an array containing a string

[3:17:03 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "[Function: ]"
@semantic-release/commit-analyzer
[3:17:04 PM] [semantic-release] [[Function: ]] › ℹ  Found 6 commits for package since last release
[3:17:04 PM] [semantic-release] [[Function: ]] › ℹ  Analysis of 6 commits complete: minor release
[3:17:04 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "[Function: ]"
[3:17:04 PM] [semantic-release] › ℹ  The next release version is 1.1.0
[3:17:04 PM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "[Function: ]"
[ '@semantic-release/release-notes-generator' ]

As a super quick fix, I edited requirePlugin in semantic-release-plugin-decorators/index to this:

const requirePlugin = module => {
  console.log(module);

  if (Array.isArray(module)) {
    return importFrom(process.cwd(), module[0]);
  }

  return importFrom(process.cwd(), module);
};

This solves the issue. I am not sure what could have caused this regression? Also not sure if this is an issue with how the monorepo is using the decorator (wrapPlugin) or in the decorator itself.

Failed step "analyzeCommits" of plugin "[Function: ]"

When trying to run semantic-release -e semantic-release-monorepo --dry-run

With no release config in package.json...

I run into the following error:

[23:25:21] [semantic-release] › ✖  Failed step "analyzeCommits" of plugin "[Function: ]"
[23:25:21] [semantic-release] › ✖  An error occurred while running semantic-release: TypeError: Expected `moduleId` to be of type `string`, got `object`

Here's the full output:

[23:25:14] [semantic-release] › ℹ  Running semantic-release version 15.13.30
[23:25:15] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/npm"
[23:25:15] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
[23:25:15] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/npm"
[23:25:15] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
[23:25:15] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
[23:25:15] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
[23:25:15] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[23:25:15] [semantic-release] › ⚠  Run automated release from branch master in dry-run mode
[23:25:19] [semantic-release] › ✔  Allowed to push to the Git repository
[23:25:19] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/npm"
[23:25:19] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/npm"
[23:25:19] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
[23:25:19] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication
[23:25:19] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/github"
[23:25:21] [semantic-release] › ℹ  No git tag version found
[23:25:21] [semantic-release] › ℹ  No previous release found, retrieving all commits
[23:25:21] [semantic-release] › ℹ  Found 9 commits since last release
[23:25:21] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "[Function: ]"
[23:25:21] [semantic-release] › ✖  Failed step "analyzeCommits" of plugin "[Function: ]"
[23:25:21] [semantic-release] › ✖  An error occurred while running semantic-release: TypeError: Expected `moduleId` to be of type `string`, got `object`
    at resolveFrom (/<path-to-project>/node_modules/resolve-from/index.js:11:9)
    at module.exports (/<path-to-project>/node_modules/resolve-from/index.js:34:41)
    at module.exports (/<path-to-project>/node_modules/semantic-release-plugin-decorators/node_modules/import-from/index.js:4:49)
    at requirePlugin (/<path-to-project>/node_modules/semantic-release-plugin-decorators/src/index.js:4:33)
    at resolvePluginFn (/<path-to-project>/node_modules/semantic-release-plugin-decorators/src/index.js:18:18)
    at /<path-to-project>/node_modules/semantic-release-plugin-decorators/src/index.js:26:20
    at validator (/<path-to-project>/node_modules/semantic-release/lib/plugins/normalize.js:34:30)
    at /<path-to-project>/node_modules/semantic-release/lib/plugins/pipeline.js:37:40
    at next (/<path-to-project>/node_modules/p-reduce/index.js:17:9)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  pluginName: '[Function: ]'
}
TypeError: Expected `moduleId` to be of type `string`, got `object`
    at resolveFrom (/<path-to-project>/node_modules/resolve-from/index.js:11:9)
    at module.exports (/<path-to-project>/node_modules/resolve-from/index.js:34:41)
    at module.exports (/<path-to-project>/node_modules/semantic-release-plugin-decorators/node_modules/import-from/index.js:4:49)
    at requirePlugin (/<path-to-project>/node_modules/semantic-release-plugin-decorators/src/index.js:4:33)
    at resolvePluginFn (/<path-to-project>/node_modules/semantic-release-plugin-decorators/src/index.js:18:18)
    at /<path-to-project>/node_modules/semantic-release-plugin-decorators/src/index.js:26:20
    at validator (/<path-to-project>/node_modules/semantic-release/lib/plugins/normalize.js:34:30)
    at /<path-to-project>/node_modules/semantic-release/lib/plugins/pipeline.js:37:40
    at next (/<path-to-project>/node_modules/p-reduce/index.js:17:9)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  pluginName: '[Function: ]'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1

Possible to set lastRelease?

I have an existing repo that I'm converting into a monorepo. So there are already tags using the default format v${version}.

So when running with -e semantic-release-monorepo it cannot find any previous releases because it's looking for the wrong tag.

The --tag-format can't be used as I want the nextRelease to have the new format.

Log

[semantic-release] » √  Completed step "verifyConditions" of plugin "@semantic-release/git"
[semantic-release] » i  No git tag version found on branch master
[semantic-release] » i  No previous release found, retrieving all commits
[semantic-release] » i  Found 64 commits since last release
[semantic-release] » i  Start step "analyzeCommits" of plugin "[Function: ]"
[semantic-release] [[Function: ]] » i  Found 0 commits for package test-package since last release
[semantic-release] [[Function: ]] » i  Analysis of 0 commits complete: no release

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.