semantic-release / github

:octocat: semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues
MIT License
390 stars 119 forks source link

prerelease config causing errors #276

Open Ridermansb opened 4 years ago

Ridermansb commented 4 years ago

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 commented 4 years ago

Created public repo to demonstrate this problem...

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

jcornaz commented 4 years ago

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

Is there any update?

leviplj commented 3 years ago

Any Update?

gr2m commented 3 years ago

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

ccjjmartin commented 3 years ago

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.

oprypkhantc commented 2 years ago

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

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

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.

travi commented 2 years ago

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.