8000 add scripts to set/update the release tag in VSTS (#6107) · PowerShell/PowerShell@363c964 · GitHub
[go: up one dir, main page]

Skip to content

Commit 363c964

Browse files
authored
add scripts to set/update the release tag in VSTS (#6107)
1 parent 8890981 commit 363c964

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tools/releaseBuild/setReleaseTag.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
param(
2+
[Parameter(HelpMessage='ReleaseTag from the job. Set to "fromBranch" or $null to update using the branch name')]
3+
[string]$ReleaseTag,
4+
5+
[Parameter(HelpMessage='The branch name used to update the release tag.')]
6+
[string]$Branch=$env:BUILD_SOURCEBRANCH,
7+
8+
[Parameter(HelpMessage='The variable name to put the new release tagin.')]
9+
[string]$Variable='ReleaseTag'
10+
)
11+
12+
# Script to set the release tag based on the branch name if it is not set or it is "fromBranch"
13+
# the branch name is expected to be release-<semver>
14+
# VSTS passes it as 'refs/heads/release-v6.0.2'
15+
16+
if($ReleaseTag -eq 'fromBranch' -or !$ReleaseTag)
17+
{
18+
$releaseTag = $Branch -replace '^.*(release-)'
19+
$vstsCommandString = "vso[task.setvariable variable=$Variable]$releaseTag"
20+
Write-Verbose -Message "setting $Variable to $releaseTag< 59B8 span class="pl-pds">" -Verbose
21+
Write-Host -Object "##$vstsCommandString"
22+
}

tools/releaseBuild/setReleaseTag.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pwsh -command ".\setReleaseTag.ps1 $*"

0 commit comments

Comments
 (0)
0