github icon indicating copy to clipboard operation
github copied to clipboard

prerelease config causing errors

Open Ridermansb opened this issue 4 years ago • 7 comments

With configuration

module.exports = {
    branches: [{ name: 'master', prerelease: true }],
    plugins: [
        '@semantic-release/commit-analyzer',
        '@semantic-release/release-notes-generator',
        [
            '@semantic-release/github',
            {
                assets: [
                    {
                        path: 'dist.zip',
                        label: 'PWA App',
                    },
                ],
            },
        ],
    ],
};

semantic-release "--dry-run" "--debug"

[6:31:02 PM] [semantic-release] › ℹ Running semantic-release version 17.1.1 [6:31:02 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github" [6:31:02 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer" [6:31:02 PM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator" [6:31:02 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github" [6:31:02 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [6:31:02 PM] [semantic-release] › ✔ Loaded plugin "success" from "@semantic-release/github" [6:31:02 PM] [semantic-release] › ✔ Loaded plugin "fail" from "@semantic-release/github" [6:31:10 PM] [semantic-release] › ⚠ Skip step "fail" of plugin "@semantic-release/github" in dry-run mode

A minimum of 1 and a maximum of 3 release branches are required in the branches configuration (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#branches).

This may occur if your repository does not have a release branch, such as master.

Your configuration for the problematic branches is [].

{ AggregateError: SemanticReleaseError: The release branches are invalid in the branches configuration. at module.exports (/Users/ridermansb/Projects/meve.ai/web/node_modules/semantic-release/lib/get-error.js:6:10) at Object.entries.reduce (/Users/ridermansb/Projects/meve.ai/web/node_modules/semantic-release/lib/branches/index.js:44:19) at Array.reduce () at module.exports (/Users/ridermansb/Projects/meve.ai/web/node_modules/semantic-release/lib/branches/index.js:34:46) at module.exports (/Users/ridermansb/Projects/meve.ai/web/node_modules/semantic-release/lib/branches/index.js:66:11) at process._tickCallback (internal/process/next_tick.js:68:7) name: 'AggregateError' }npm ERR! code ELIFECYCLE

Ridermansb avatar Jun 25 '20 21:06 Ridermansb

Created public repo to demonstrate this problem...

https://github.com/Ridermansb/react-firebase-ssr/runs/813996442?check_suite_focus=true

Ridermansb avatar Jun 27 '20 12:06 Ridermansb

I have the same problem. Similar config, same failure.

Is there any update?

jcornaz avatar Jul 02 '20 09:07 jcornaz

Any Update?

leviplj avatar Dec 16 '20 20:12 leviplj

at this point, you need to have at least one branch configured that is not configured as prerelease

gr2m avatar Dec 16 '20 22:12 gr2m

I would recommend closing this issue, I am using prerelease config just fine with the latest version and at at least one named branch that isn't a prerelease branch. Here is my working config in release.config.js (maybe other file names are causing this issue though?):

module.exports = {
  branches: [
    '+([0-9])?(.{+([0-9]),x}).x',
    'stable',
    {name: 'rc', prerelease: true},
    {name: 'beta', prerelease: true},
    {name: 'alpha', prerelease: true}
  ],
  plugins: [
    ['@semantic-release/commit-analyzer'],
    '@semantic-release/release-notes-generator',
    [
      '@semantic-release/changelog',
      {
        changelogFile: 'CHANGELOG.md',
      },
    ],
    '@semantic-release/git',
    "@semantic-release/github",
  ],
};

For anyone who is curious this code '+([0-9])?(.{+([0-9]),x}).x', is for maintenance branches like 1.x or 2.1.x, they do need to end in an x.

ccjjmartin avatar Jan 15 '21 18:01 ccjjmartin

@ccjjmartin We're trying to run this without stable releases.

@gr2m Why is this so? Our situation is as follows:

  • we use Github's templates for our packages
  • every time you create a repository from a template repository, GitHub copies all branches and makes an initial commit in each of them (with the contents from the template, obviously)
  • we have a semantic-release workflow configured in our template
  • we only have an "alpha" branch in our template

The problem is that if we create a stable branch in the template, semantic-release will automatically publish a 1.0.0 stable release right after using the template. If you don't create a stable branch, it should just publish a 1.0.0-alpha.1 release, but it instead fails expecting at least one stable branch to exist.

This check doesn't make any sense at all.

oprypkhantc avatar Jan 28 '22 10:01 oprypkhantc

The problem is that if we create a stable branch in the template, semantic-release will automatically publish a 1.0.0 stable release right after using the template.

this is only true if the commit uses type feat, fix, or perf (assuming you are using the default configuration). if there are no commits in the history of the branch that should result in a new version, no release will be published.

This check doesn't make any sense at all.

please do not make statements like this without complete information. i've given some explanation around the reason behind this requirement in response to the issue you opened in https://github.com/semantic-release/semantic-release/issues/2345#issuecomment-1024352411. in the future, it would be appreciated if you gather agreement from the maintainers before deciding that existing checks provide no value and opening a PR to remove.

travi avatar Jan 28 '22 16:01 travi