-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d096ce7
commit 9cd7ef6
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
variables: | ||
CurrentSemanticVersionBase: '6.0.0' | ||
PreviewNumber: $[counter(variables['CurrentSemanticVersionBase'], 1001)] | ||
CurrentSemanticVersion: '$(CurrentSemanticVersionBase)-preview$(PreviewNumber)' | ||
NugetPackageVersion: '$(CurrentSemanticVersion)' | ||
NET_VERSION: '6.0.x' | ||
PathToSolution: 'src/InAppBilling.sln' | ||
PathToCsproj: 'src/Plugin.InAppBilling/Plugin.InAppBilling.csproj' | ||
XcodeVersion: '13.1' | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- main | ||
tags: | ||
include: | ||
- '*' | ||
paths: | ||
exclude: | ||
- README.md | ||
|
||
pr: | ||
autoCancel: 'true' | ||
branches: | ||
include: | ||
- main | ||
paths: | ||
exclude: | ||
- README.md | ||
|
||
jobs: | ||
- job: build_windows | ||
displayName: Build Windows Library | ||
pool: | ||
vmImage: windows-2022 | ||
steps: | ||
- task: UseDotNet@2 | ||
displayName: 'Install .NET SDK' | ||
inputs: | ||
version: '$(NET_VERSION)' | ||
- task: CmdLine@2 | ||
displayName: 'Install .NET MAUI workload' | ||
inputs: | ||
script: 'dotnet workload install maui' | ||
# if this is a tagged build, then update the version number | ||
- powershell: | | ||
$buildSourceBranch = "$(Build.SourceBranch)" | ||
$tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1) | ||
Write-Host("Branch = $buildSourceBranch, Version = $tagVersion"); | ||
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion") | ||
displayName: Set NuGet Version to Tag Number | ||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') | ||
# if this is a PR build, then update the version number | ||
- powershell: | | ||
$prNumber = $env:System_PullRequest_PullRequestNumber | ||
$commitId = "$($env:System_PullRequest_SourceCommitId)".Substring(0, 7) | ||
$fullVersionString = "$(CurrentSemanticVersionBase)-build-$prNumber.$(Build.BuildId)+$commitId" | ||
Write-Host("GitHub PR = $prNumber, Commit = $commitId"); | ||
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$fullVersionString") | ||
Write-Host "##vso[build.updatebuildnumber]$fullVersionString" | ||
displayName: Set NuGet Version to PR Version | ||
condition: and(succeeded(), eq(variables['build.reason'], 'PullRequest')) | ||
# build, test and pack the packages | ||
- task: VSBuild@1 | ||
displayName: 'Build Community Toolkit Sample' | ||
inputs: | ||
solution: '$(PathToCsproj)' | ||
configuration: 'Release' | ||
msbuildArgs: '/restore' | ||
- task: VSBuild@1 | ||
displayName: 'Build and Pack' | ||
inputs: | ||
solution: '$(PathToCommunityToolkitCoreCsproj)' | ||
configuration: 'Release' | ||
msbuildArgs: '/restore -t:pack -p:PackageVersion=$(NugetPackageVersion) -p:Version=$(NugetPackageVersion) /p:OutputPath=$(Build.ArtifactStagingDirectory)/nuget -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg' | ||
# publish the packages | ||
- task: PublishBuildArtifacts@1 | ||
displayName: 'Publish NuGets' | ||
inputs: | ||
artifactName: nuget | ||
pathToPublish: '$(Build.ArtifactStagingDirectory)/nuget' |