This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.yml
101 lines (84 loc) · 2.96 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
pool:
vmImage: windows-2019
variables:
- group: Xamarin NuGetized
resources:
repositories:
- repository: templates
type: github
name: xamarin/yaml-templates
ref: refs/heads/master
endpoint: xamarin
steps:
- checkout: self
clean: true
- task: UseDotNet@2
inputs:
version: 2.1.807
- task: UseDotNet@2
inputs:
useGlobalJson: true
- task: MSBuild@1
displayName: Restore
inputs:
solution: build.proj
msbuildArguments: /t:Restore /bl:"$(Build.ArtifactStagingDirectory)\restore.binlog"
- task: MSBuild@1
displayName: Build
inputs:
solution: build.proj
msbuildArguments: /t:Build /p:Out="$(Build.ArtifactStagingDirectory)" /bl:"$(Build.ArtifactStagingDirectory)\build.binlog"
- task: VSTest@2
displayName: Test
inputs:
testAssemblyVer2: |-
**\*.Tests.dll
!**\xunit*.dll
codeCoverageEnabled: 'true'
publishRunAttachments: 'true'
- template: sleet/v1.yml@templates
parameters:
connectionString: $(SLEET_FEED_CONNECTIONSTRING)
container: xvs
packages: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
displayName: Publish
condition: always()
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: output
ArtifactType: Container
- task: NuGetCommand@2
displayName: 'NuGet Update'
inputs:
command: custom
arguments: 'update -self'
- pwsh: |
$branch = '$(Build.SourceBranch)'
$push = "$($branch -eq 'refs/heads/master' -or $branch -match 'refs/heads/d\d\d-*|refs/heads/rel/*')".ToLowerInvariant()
Write-Host "##vso[task.setvariable variable=PushPackages;]$push"
displayName: Set PushPackages
condition: eq(variables['PushPackages'], '')
# This step is required to override the apitoken for 'xamarin-impl public feed' with a federated token from 'xamarin-impl-public-feed'
- task: AzureCLI@2
displayName: 'Set Xamarin Impl token'
inputs:
azureSubscription: 'xamarin-impl-public-feed' # The managed identity based service connection (no spaces)
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
# Set the access token as a secret, so it doesn't get leaked in the logs
Write-Host "##vso[task.setsecret]$accessToken"
# Override the apitoken of the nuget service connection, for the duration of this stage
# xamarin-impl public feed = d567a069-5a03-4f36-b4c6-0dec6f32b697
Write-Host "##vso[task.setendpoint id=d567a069-5a03-4f36-b4c6-0dec6f32b697;field=authParameter;key=apitoken]$accessToken"
- task: NuGetCommand@2
displayName: Push Packages
continueOnError: true
condition: and(succeeded(), eq(variables['PushPackages'], 'true'))
inputs:
command: push
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: 'xamarin-impl public feed' # The PAT based service connection (has spaces)