[英]What is the best way to create git tags from Azure Pipelines?
I'm currently using an extension to create the git tag, my problem is that I'm using the Azure Platform to add the variables instead of the yaml file.我目前正在使用扩展来创建 git 标签,我的问题是我使用 Azure 平台添加变量而不是 yaml 文件。
- task: GitTag@6
displayName: 'Creating Git Tag'
inputs:
workingdir: '$(SYSTEM.DEFAULTWORKINGDIRECTORY)'
git: '$(Major).$(Minor).$(Patch)'
The Variables are:变量是:
Name:
Major
Value:
1
Name:
Minor
Value:
0
Name:
Patch
Value:
$[counter(format('{0}.{1}', variables['Major'], variables['Minor']), 0)]
The current output is the following:当前的output如下:
1.0.0
My question would be: How can I declare the Patch as a variable in the yaml file.我的问题是:如何在 yaml 文件中将补丁声明为变量。 I tried to add the following variables:
我尝试添加以下变量:
- name: Major
value: 1
- name: Minor
value: 0
- name: patch
value: echo "##vso$[counter(format('{0}.{1}', variables['Major'], variables['Minor']), 0)]"
Now my new output is:现在我的新 output 是:
1.0.$[counter(format('{0}.{1}', variables['Major'], variables['Minor'])
Does anyone knows how can I add a script as a variable inside of the yaml file?有谁知道如何在 yaml 文件中添加脚本作为变量?
You might be able to use the Run Inline Powershell Azure Pipelines task, like so:您也许可以使用Run Inline Powershell Azure Pipelines 任务,如下所示:
- task: InlinePowershell@1
inputs:
Script: |
$foo = 'bar'
Write-Output "##vso[task.setvariable variable=foo;]$foo"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.