无法在本地或远程找到“开发”或“主”分支。- 语义gitversion

Nar*_*Ede 6 semantic-versioning gitversion azure-devops azure-pipelines

我在 azure 中有一个存储库,它有默认分支“main”。

另外,我在 yml 文件中有一项用于语义版本控制的任务。

- task: gittools.gitversion.gitversion-task.GitVersion@5
  displayName: Get Semantic Git Version 
Run Code Online (Sandbox Code Playgroud)

我遇到了以下错误

找不到分支个人/release1 的分支配置,回退到默认配置 System.InvalidOperationException:无法找到“开发”或“主”分支,无论是本地还是远程。

所以,我刚刚创建了一个开发分支并触发了构建,然后语义版本就成功了。

我们不想按照指导方针维护开发或主分支。

在不维护master和develop分支的情况下如何克服错误呢?

谢谢

纳雷什·埃德

Krz*_*tof 5

看起来GitTools\GitVersion尚不支持此功能,仍在等待解决方案。

但为了克服这个问题,你可以提供 GitVersion.yml 文件

mode: ContinuousDelivery
branches:
  master:
    regex: main
    mode: ContinuousDelivery
    tag:
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
  feature:
    regex: feature(s)?[/-]
    mode: ContinuousDeployment
  develop:
    regex: dev(elop)?(ment)?$
    mode: ContinuousDeployment
    tag: alpha
  hotfix:
    regex: hotfix(es)?[/-]
    mode: ContinuousDeployment
    tag: beta
  release:
    regex: release(s)?[/-]
    mode: ContinuousDeployment
    tag: rc
ignore:
  sha: []
Run Code Online (Sandbox Code Playgroud)

然后像这样使用它

steps:
- task: GitVersion@5
  inputs:
    runtime: 'core'
    configFilePath: 'GitVersion.yml'
    updateAssemblyInfo: true
Run Code Online (Sandbox Code Playgroud)