ERELEASEBRANCHES The release branches are invalid in the `branches` configuration. when I use object
Asked Answered
C

2

14

I'm using semantic-release, and I'm trying to create prerelease 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' } ],
            },
        ],
    ],
};

As you can see the branches its's just an object with name and prerelase (I also tried to use as array, same problem)

Public repository with the error:
https://github.com/Ridermansb/react-firebase-ssr/runs/813996442?check_suite_focus=true

THE ERROR

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


I Also create tickets on semantic-release/github and semantic-release/semantic-release repo

Carlyncarlynn answered 27/6, 2020 at 13:0 Comment(0)
U
14

I solved my issue by adding "release": { "branches": [ "master" ] }, in package.json and remove it from the module.exports https://semantic-release.gitbook.io/semantic-release/v/beta/usage/configuration

Urochrome answered 5/11, 2020 at 22:26 Comment(0)
R
7

You need to have at least one release branch specified. This branch needs to exist in the remote repository.

Rubel answered 25/11, 2020 at 16:58 Comment(1)
This was my problem, just to elaborate a little it was because the release branch I specified did not exist on remote. Once I pushed/created it semantic-release worked.Gujarati

© 2022 - 2024 — McMap. All rights reserved.