Skip to content

Commit

Permalink
Set version artificially for the test template runs (Azure#15550)
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu authored and annelo-msft committed Feb 17, 2021
1 parent ae74788 commit cf77875
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
7 changes: 7 additions & 0 deletions eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ jobs:
pool:
vmImage: windows-2019
steps:
- task: PowerShell@2
displayName: Prep template pipeline for release
condition: and(succeeded(),eq(variables['TestPipeline'],'true'))
inputs:
pwsh: true
workingDirectory: $(Build.SourcesDirectory)
filePath: eng/scripts/SetTestPipelineVersion.ps1
- pwsh: |
echo "##vso[build.addbuildtag]Scheduled"
displayName: "Tag scheduled builds"
Expand Down
7 changes: 7 additions & 0 deletions eng/pipelines/templates/stages/archetype-net-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ stages:
deploy:
steps:
- checkout: self
- task: PowerShell@2
displayName: Prep template pipeline for release
condition: and(succeeded(),eq(variables['TestPipeline'],'true'))
inputs:
pwsh: true
workingDirectory: $(Build.SourcesDirectory)
filePath: eng/scripts/SetTestPipelineVersion.ps1
- template: /eng/common/pipelines/templates/steps/verify-changelog.yml
parameters:
PackageName: ${{artifact.name}}
Expand Down
28 changes: 28 additions & 0 deletions eng/scripts/SetTestPipelineVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Overides the project file and CHANGELOG.md for the template project using the next publishable version
# This is to help with testing the release pipeline.
. "${PSScriptRoot}\..\common\scripts\common.ps1"
$latestTags = git tag -l "Azure.Template_*"
$semVars = @()

$changeLogFile = "${PSScriptRoot}\..\..\sdk\template\Azure.Template\CHANGELOG.md"

Foreach ($tags in $latestTags)
{
$semVars += $tags.Replace("Azure.Template_", "")
}

$semVarsSorted = [AzureEngSemanticVersion]::SortVersionStrings($semVars)
LogDebug "Last Published Version $($semVarsSorted[0])"

$newVersion = [AzureEngSemanticVersion]::ParseVersionString($semVarsSorted[0])
$newVersion.IncrementAndSetToPrerelease()
LogDebug "Version to publish [ $($newVersion.ToString()) ]"

&"${PSScriptRoot}/Update-PkgVersion.ps1" -ServiceDirectory "template" `
-PackageName 'Azure.Template' -PackageDirName "Azure.Template" -NewVersionString $newVersion.ToString() `
-ReleaseDate (Get-Date -f "yyyy-MM-dd")
Set-Content -Path $changeLogFile -Value @"
# Release History
## $($newVersion.ToString()) ($(Get-Date -f "yyyy-MM-dd"))
- Test Release Pipeline
"@

0 comments on commit cf77875

Please sign in to comment.