Skip to content

Commit

Permalink
Added internal versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Haplois committed Nov 23, 2021
1 parent b2ad865 commit 5e1be90
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Project>
<PropertyGroup>
<!-- This repo version -->
<VersionPrefix>6.0.0</VersionPrefix>
<PreReleaseVersionLabel>beta</PreReleaseVersionLabel>
<VersionPrefix>2.2.8</VersionPrefix>
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<!-- Opt-out repo features -->
<UsingToolXliff>false</UsingToolXliff>
<MicrosoftNETTestSdkVersion>17.1.0-preview-20211118-01</MicrosoftNETTestSdkVersion>
Expand Down
53 changes: 53 additions & 0 deletions scripts/vsts-prebuild.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.

# Sets variables which are used across the build tasks.

param (
[Parameter(Mandatory)]
[string] $IsRtmBuild
)

$TPB_BRANCH = "LOCALBRANCH"
$TPB_COMMIT = "LOCALBUILD"
$TPB_ROOT_DIR = (Get-Item (Split-Path $MyInvocation.MyCommand.Path)).Parent.FullName
$TPB_ENG_DIR = Join-Path $TPB_ROOT_DIR "eng"

$TPB_VERSION_PREFIX = ([xml](Get-Content $TPB_ENG_DIR\Versions.props)).Project.PropertyGroup.VersionPrefix
$TPB_RELEASE_VERSION_LABEL = ([xml](Get-Content $TPB_ENG_DIR\Versions.props)).Project.PropertyGroup.PreReleaseVersionLabel
$TPB_BUILD_NUMBER = IF ($env:BUILD_BUILDNUMBER -ne $null) { $env:BUILD_BUILDNUMBER } ELSE { "LOCAL" }
$TPB_PACKAGE_VERSION = "$TPB_VERSION_PREFIX-$TPB_RELEASE_VERSION_LABEL-$TPB_BUILD_NUMBER"

if ($IsRtmBuild -eq "true") {
$TPB_PACKAGE_VERSION = "$TPB_VERSION_PREFIX"
}

try {
$TPB_BRANCH = $env:BUILD_SOURCEBRANCH -replace "^refs/heads/"
if ([string]::IsNullOrWhiteSpace($TPB_BRANCH)) {
$TPB_BRANCH = git -C "." rev-parse --abbrev-ref HEAD
}
}
catch { }

try {
$TPB_COMMIT = $env:BUILD_SOURCEVERSION
if ([string]::IsNullOrWhiteSpace($TPB_COMMIT)) {
$TPB_COMMIT = git -C "." rev-parse HEAD
}
}
catch { }

Get-ChildItem variable:TP*

if ($IsRtmBuild -eq "true" -and ($TPB_RELEASE_VERSION_LABEL -ne "release" -and $TPB_RELEASE_VERSION_LABEL -ne "servicing")) {
throw "An RTM build cannot be based on a ``$TPB_RELEASE_VERSION_LABEL`` build!"
}

Write-Host "##vso[task.setvariable variable=TestAdapterNugetVersion;]$TPB_VERSION_PREFIX"
Write-Host "##vso[task.setvariable variable=TestFrameworkNugetVersion;]$TPB_VERSION_PREFIX"
Write-Host "##vso[task.setvariable variable=NugetVersionSuffix;]$TPB_RELEASE_VERSION_LABEL"

Write-Host "##vso[task.setvariable variable=BuildVersionPrefix;]$TPB_VERSION_PREFIX"
Write-Host "##vso[task.setvariable variable=BuildVersionSuffix;]$TPB_RELEASE_VERSION_LABEL"
Write-Host "##vso[task.setvariable variable=PackageVersion;]$TPB_PACKAGE_VERSION"

0 comments on commit 5e1be90

Please sign in to comment.