gpt4 book ai didi

GitVersion 配置不递增

转载 作者:行者123 更新时间:2023-12-02 00:49:57 26 4
gpt4 key购买 nike

我正在尝试设置 GitVersion处理我们项目的语义版本控制 (GitFlow),但它并没有像我期望的那样自动递增。我也在努力阅读项目的文档,这不是最容易理解的。

基本上我们希望建立一个具有 Major.Minor.Patch 约定的版本控制系统,我们手动增加 Major,当一个 release 分支 merge 到 master 时自动增加 Minor,当一个 feature 分支 merge 到 develop 时自动增加 P​​atch。

这是我现在的 GitVersion.yml

mode: ContinuousDeployment
branches:
feature:
increment: Patch
regex: feature?[/-]
release:
increment: Minor
regex: release?[/-]
develop:
regex: develop$
master:
regex: master$
ignore:
sha: []

同样为了测试它,我写了一个小的 ruby​​ 脚本来加速这个乏味的过程。我包含它只是为了确保我以预期的方式使用 GitVersion 和 GitFlow。
require "git"

def new_feature_branch i
g = Git.open(Dir.pwd)

branch_name = "feature/number-#{i}"
g.checkout("develop")
g.branch(branch_name).checkout

open('README.md', 'a') do |f|
f.puts "\r#{i}"
end

g.add("README.md")
g.commit("##{i}")

g.branch("develop").checkout
g.merge(branch_name)
g.branch(branch_name).delete

print(`gitversion`)
end


new_feature_branch(ARGV[0])
gitversion 的输出
{
"Major":1,
"Minor":1,
"Patch":0,
"PreReleaseTag":"alpha.39",
"PreReleaseTagWithDash":"-alpha.39",
"PreReleaseLabel":"alpha",
"PreReleaseNumber":39,
"WeightedPreReleaseNumber":39,
"BuildMetaData":"",
"BuildMetaDataPadded":"",
"FullBuildMetaData":"Branch.develop.Sha.57a536a5c6b6abb4313a2067468413447cb49c86",
"MajorMinorPatch":"1.1.0",
"SemVer":"1.1.0-alpha.39",
"LegacySemVer":"1.1.0-alpha39",
"LegacySemVerPadded":"1.1.0-alpha0039",
"AssemblySemVer":"1.1.0.0",
"AssemblySemFileVer":"1.1.0.0",
"FullSemVer":"1.1.0-alpha.39",
"InformationalVersion":"1.1.0-alpha.39+Branch.develop.Sha.57a536a5c6b6abb4313a2067468413447cb49c86",
"BranchName":"develop",
"Sha":"57a536a5c6b6abb4313a2067468413447cb49c86",
"ShortSha":"57a536a",
"NuGetVersionV2":"1.1.0-alpha0039",
"NuGetVersion":"1.1.0-alpha0039",
"NuGetPreReleaseTagV2":"alpha0039",
"NuGetPreReleaseTag":"alpha0039",
"VersionSourceSha":"27938c50fc6f364eff52bccec8dbc10297bce87b",
"CommitsSinceVersionSource":39,
"CommitsSinceVersionSourcePadded":"0039",
"CommitDate":"2019-10-28"
}

每次我将功能分支 merge 到 develop 时,我都希望补丁号增加的问题,但这并没有发生。

最佳答案

仍然存在一些小问题,但此配置设置的工作量远超我的预期。

mode: Mainline
tag-prefix: '[vV]'
commit-message-incrementing: MergeMessageOnly
branches:
feature:
regex: feature?[/-]
source-branches: ['develop']
release:
increment: Minor
regex: release?[/-]
develop:
is-mainline: true
increment: Patch
regex: develop$
master:
regex: master$

关于GitVersion 配置不递增,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58594554/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com