ci: Remove the prerelease version number, include build id

This commit is contained in:
Jerome Laban 2021-07-12 11:11:54 -04:00
Родитель 7ae9b3dd49
Коммит fc88dcd4f7
2 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -6,7 +6,7 @@ steps:
# This step changes the PR version ID so that produced nuget packages can be tied
# to specific builds. This can be used to create canaries from PR artifacts.
- powershell: |
$PR_VERSION="PullRequest-$env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER-$env:BUILD_BUILDID-$env:SYSTEM_JOBATTEMPT-"
$PR_VERSION="PullRequest-$env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER-$env:BUILD_BUILDID-"
echo "Updating PR Version Tag in GitVersion to $PR_VERSION"
(Get-Content gitversion.yml).replace("'PullRequest'", "$PR_VERSION") | Set-Content gitversion.yml
@ -43,3 +43,15 @@ steps:
useConfigFile: true
configFilePath: gitversion.yml
displayName: Use GitVersion
- powershell: |
$PR_VERSION="$(GITVERSION.SemVer)"
$PR_VERSION=$PR_VERSION.replace('.$(GitVersion.PreReleaseNumber)','')
## Updating the semver value is required to avoid race conditions with multiple
## jobs creating packages, and update pushed to the main branch.
echo "Updating PR Version from [$(GITVERSION.SemVer)] to [$PR_VERSION]"
echo '##vso[task.setvariable variable=GITVERSION.SemVer]$PR_VERSION'
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: Update GITVERSION.SemVer for PullRequests

Просмотреть файл

@ -16,7 +16,7 @@ branches:
pull-request:
regex: ^(pull|pull\-requests|pr)[/-]
mode: ContinuousDelivery
mode: ContinuousDeployment
tag: 'PullRequest'
tag-number-pattern: '[/-](?<number>\d+)[-/]'
increment: Inherit