From 023c4e23c6b4c25da11e6c0091583ceda656a5fc Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 5 Feb 2018 19:17:46 -0800 Subject: [PATCH] add scripts to set/update the release tag in VSTS --- tools/releaseBuild/setReleaseTag.ps1 | 22 ++++++++++++++++++++++ tools/releaseBuild/setReleaseTag.sh | 1 + 2 files changed, 23 insertions(+) create mode 100644 tools/releaseBuild/setReleaseTag.ps1 create mode 100644 tools/releaseBuild/setReleaseTag.sh diff --git a/tools/releaseBuild/setReleaseTag.ps1 b/tools/releaseBuild/setReleaseTag.ps1 new file mode 100644 index 00000000000..581e2060beb --- /dev/null +++ b/tools/releaseBuild/setReleaseTag.ps1 @@ -0,0 +1,22 @@ +param( + [Parameter(HelpMessage='ReleaseTag from the job. Set to "fromBranch" or $null to update using the branch name')] + [string]$ReleaseTag, + + [Parameter(HelpMessage='The branch name used to update the release tag.')] + [string]$Branch=$env:BUILD_SOURCEBRANCH, + + [Parameter(HelpMessage='The variable name to put the new release tagin.')] + [string]$Variable='ReleaseTag' +) + +# Script to set the release tag based on the branch name if it is not set or it is "fromBranch" +# the branch name is expected to be release- +# VSTS passes it as 'refs/heads/release-v6.0.2' + +if($ReleaseTag -eq 'fromBranch' -or !$ReleaseTag) +{ + $releaseTag = $Branch -replace '^.*(release-)' + $vstsCommandString = "vso[task.setvariable variable=$Variable]$releaseTag" + Write-Verbose -Message "setting $Variable to $releaseTag" -Verbose + Write-Host -Object "##$vstsCommandString" +} diff --git a/tools/releaseBuild/setReleaseTag.sh b/tools/releaseBuild/setReleaseTag.sh new file mode 100644 index 00000000000..842ba1e755b --- /dev/null +++ b/tools/releaseBuild/setReleaseTag.sh @@ -0,0 +1 @@ +pwsh -command ".\setReleaseTag.ps1 $*"