qiwi / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
86 stars 34 forks source link

Failed while trying to release several packages on blank repo #12

Closed antongolub closed 4 years ago

antongolub commented 4 years ago

travis#174292182

[3:49:55 PM] [@qiwi/nestjs-enterprise-common] › ✔  Allowed to push to the Git repository
[3:49:55 PM] [@qiwi/nestjs-enterprise-common] › ℹ  Start step "verifyConditions" of plugin "Inline plugin"
[3:49:55 PM] [@qiwi/nestjs-enterprise] › ✔  Allowed to push to the Git repository
[3:49:55 PM] [@qiwi/nestjs-enterprise] › ℹ  Start step "verifyConditions" of plugin "Inline plugin"
qiwibot
[3:49:56 PM] [@qiwi/nestjs-enterprise-common] › ✔  Completed step "verifyConditions" of plugin "Inline plugin"
[3:49:56 PM] [@qiwi/nestjs-enterprise-common] › ℹ  No git tag version found on branch master
[3:49:56 PM] [@qiwi/nestjs-enterprise-common] › ℹ  No previous release found, retrieving all commits
[3:49:56 PM] [@qiwi/nestjs-enterprise-common] › ℹ  Found 9 commits since last release
[3:49:56 PM] [@qiwi/nestjs-enterprise-common] › ℹ  Start step "analyzeCommits" of plugin "Inline plugin"
qiwibot
[3:49:56 PM] [@qiwi/nestjs-enterprise] › ✔  Completed step "verifyConditions" of plugin "Inline plugin"
[3:49:56 PM] [@qiwi/nestjs-enterprise] › ℹ  No git tag version found on branch master
[3:49:56 PM] [@qiwi/nestjs-enterprise] › ℹ  No previous release found, retrieving all commits
[3:49:56 PM] [@qiwi/nestjs-enterprise] › ℹ  Found 9 commits since last release
[3:49:56 PM] [@qiwi/nestjs-enterprise] › ℹ  Start step "analyzeCommits" of plugin "Inline plugin"
[3:49:56 PM] [@qiwi/nestjs-enterprise-common] › ✔  Completed step "analyzeCommits" of plugin "Inline plugin"
[3:49:56 PM] [@qiwi/nestjs-enterprise] › ✔  Completed step "analyzeCommits" of plugin "Inline plugin"
[3:49:56 PM] [@qiwi/nestjs-enterprise-common] › ℹ  There are no relevant changes, so no new version is released.
[3:49:56 PM] [@qiwi/nestjs-enterprise] › ℹ  There is no previous release, the next release version is 1.0.0
[3:49:56 PM] [@qiwi/nestjs-enterprise] › ℹ  Start step "generateNotes" of plugin "Inline plugin"
[3:49:56 PM] [@qiwi/nestjs-enterprise] › ✖  Failed step "generateNotes" of plugin "Inline plugin"
[3:49:56 PM] [@qiwi/nestjs-enterprise] › ✖  An error occurred while running semantic-release: Error: Cannot release because dependency @qiwi/nestjs-enterprise-common has not been released
    at /home/travis/build/qiwi/nestjs-enterprise/node_modules/@qiwi/multi-semantic-release/lib/createInlinePluginCreator.js:68:11
    at Array.forEach (<anonymous>)
    at updateManifestDeps (/home/travis/build/qiwi/nestjs-enterprise/node_modules/@qiwi/multi-semantic-release/lib/createInlinePluginCreator.js:62:18)
context.commits = await getCommits(context);

  const nextRelease = {
    type: await plugins.analyzeCommits(context),
    channel: context.branch.channel || null,
    gitHead: await getGitHead({cwd, env}),
  };
  if (!nextRelease.type) {
    logger.log('There are no relevant changes, so no new version is released.');
    return context.releases.length > 0 ? {releases: context.releases} : false;
  }
antongolub commented 4 years ago

The first package have no commits requiring release, but the second depends on the first. So, this is not a tool issue. builds/174295307

yyynnn commented 4 years ago

this is a cryptic error, why should the process fail?

antongolub commented 4 years ago

@yyynnn

Hi.

It seems that if we skip this a check, we will publish a package that cannot be installed because its dependency is not yet present in the registry. No tag > no release > no package

// Loop through localDeps to update dependencies/devDependencies/peerDependencies in manifest.
pkg._localDeps.forEach((d) => {
    // Get version of dependency.
    const release = d._nextRelease || d._lastRelease;

    // Cannot establish version.
    if (!release || !release.version)
        throw Error(`Cannot release because dependency ${d.name} has not been released`);