Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semantic-release ignores branch configuration #2448

Open
mmisztal1980 opened this issue Jun 3, 2022 · 2 comments
Open

semantic-release ignores branch configuration #2448

mmisztal1980 opened this issue Jun 3, 2022 · 2 comments

Comments

@mmisztal1980
Copy link

Current behavior

release.config.js

module.exports = {
  branches: [
    {
      name: "release/+([0-9])?(.{+([0-9]),x}).x",
      range: "${name.replace(/^release\\//g, '')}",
      prerelease: true
    },
    "main"
  ],
  verifyConditions: [
    "@semantic-release/changelog",
    "@semantic-release/git",
    //"@semantic-release/github",
  ],
  plugins: [
    ["@semantic-release/commit-analyzer", {
      "preset": "conventionalcommits",
      "parserOpts": {
        "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
      }
    }],
    ['@semantic-release/changelog',
    {
      changelogFile: 'CHANGELOG.md',
    }],
    ['@semantic-release/git', {
      assets: ['CHANGELOG.md'],
      message:
      // eslint-disable-next-line no-template-curly-in-string
      'chore(release): ${nextRelease.version} [skip ci]',
    }],
    ["@semantic-release/release-notes-generator", {
      "preset": "conventionalcommits",
      "parserOpts": {
        "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
      },
      "writerOpts": {
        "commitsSort": ["subject", "scope"]
      }
    }],
    ["semantic-release-dotnet", {
      paths: ["src/**/*.csproj"],
    }],
  ],
};

Console:

git checkout -b release/1.5
git add .
git commit -m "feat: test"
git push origin release/1.5
npx semantic-release --no-ci

This test run was triggered on the branch release/1.5, while semantic-release is configured to only publish from main, therefore a new version won’t be published.

Expected behavior

I'm expecting semantic-release to detect the configured release/* branches

Environment

  • semantic-release version: ^19.0.2
  • CI environment: none
  • Plugins used:
{
  "devDependencies": {
    "@commitlint/cli": "^16.2.4",
    "@commitlint/config-conventional": "^16.2.4",
    "@semantic-release/changelog": "^6.0.1",
    "@semantic-release/commit-analyzer": "^9.0.2",
    "@semantic-release/exec": "^6.0.3",
    "@semantic-release/git": "^10.0.1",
    "@semantic-release/github": "^8.0.4",
    "@semantic-release/release-notes-generator": "^10.0.3",
    "conventional-changelog-conventionalcommits": "^5.0.0",
    "husky": "^8.0.1",
    "semantic-release": "^19.0.2",
    "semantic-release-dotnet": "^1.0.0"
  }
}
  • semantic-release configuration: N/A
  • CI logs: local run
@r1m
Copy link

r1m commented Jul 28, 2022

I had the same issue. The error message is misleading, it displays actual remote branches that match a release branch.
In your case only the origin/main is matching.

release/1.5 does not match release/+([0-9])?(.{+([0-9]),x}).x, is is missing the leading x

@kleinfreund
Copy link
Contributor

kleinfreund commented Sep 10, 2023

I'm getting this when explicitly passing in a literal branch name using --branches (same with changing the branches option in the conifg). I need this somewhat commonly on non-release branches with dryRun while testing new semantic-release configurations.

semantic-release --dryRun --branches main,feat/branch --debug

Relevant Debug output:

  semantic-release:config   branches: [ 'main', 'feat/branch' ],

Error:

[6:53:03 PM] [semantic-release] » ℹ  This test run was triggered on the branch feat/branch, while semantic-release is configured to only publish from main, therefore a new version won’t be published.

This error is at the very least misleading because it's incorrect: semantic-release knows that its configured with two release branches (see debug output). One of which is the branch that's checked out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants