Skip to content

Commit c167bbc

Browse files
authored
create YMAL based pipeline (#254)
* swtich to test source * swtich to test source (#249) * update config * Azure artifact (#250) * swtich to test source * update config * update comments * Azure artifact (#251) * swtich to test source * update config * update comments * update config * update config * update config * update config * update config * update config * update config * update config * remove parameter check no longer needed * Set up CI with Azure Pipelines for YAML azure-powershell-common * test random apikey * test random apikey * try access key * try nuget authentication * try apikey * remove apikey * use az as api key * remove publish to nuget from publish.proj * Update Azure-PowerShell-Common-Publish.yml for Azure Pipelines * Update Azure-PowerShell-Common-Publish.yml for Azure Pipelines * Update Azure-PowerShell-Common-Publish.yml for Azure Pipelines * Update NuGet.config * Update Azure-PowerShell-Common-Publish.yml * Update Azure-PowerShell-Common-Publish.yml * Update Azure-PowerShell-Common-Publish.yml * specify nupkg pattern * fix pattern * fix * add condition for publish
1 parent bae7d80 commit c167bbc

File tree

3 files changed

+111
-7
lines changed

3 files changed

+111
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Starter pipeline
2+
# Start with a minimal pipeline that you can customize to build and deploy your code.
3+
# Add steps that build, run tests, deploy, and more:
4+
# https://aka.ms/yaml
5+
6+
trigger:
7+
- master
8+
9+
pool:
10+
name: Hosted VS2017
11+
12+
variables:
13+
- group: GitHub Release Variables
14+
15+
steps:
16+
- powershell: |
17+
# Write your PowerShell commands here.
18+
if (-not ($env:VERSION -match "\d+\.\d+\.\d+"))
19+
{
20+
throw "The value of Version $env:VERSION must be format of X.X.X"
21+
}
22+
23+
displayName: 'Check Version'
24+
25+
- task: UseDotNet@2
26+
displayName: 'Use dotnet sdk 2.1.302'
27+
inputs:
28+
version: 2.1.302
29+
30+
- powershell: '$(Agent.ToolsDirectory)/dotnet/dotnet msbuild build.proj /t:Build /p:Configuration=Release /p:FileVersion=$env:VERSION /NoLogo'
31+
displayName: build
32+
33+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
34+
displayName: 'dll Signing'
35+
inputs:
36+
ConnectedServiceName: 'ESRP Signing Service'
37+
FolderPath: artifacts
38+
Pattern: |
39+
Release\netstandard2.0\Microsoft.Azure.PowerShell*.dll
40+
!Release\netstandard2.0\Microsoft.Azure.PowerShell*.Test.dll
41+
UseMinimatch: true
42+
signConfigType: inlineSignParams
43+
inlineOperation: |
44+
[
45+
{
46+
"KeyCode": "CP-233863-SN",
47+
"OperationCode": "StrongNameSign",
48+
"Parameters": {},
49+
"ToolName": "sign",
50+
"ToolVersion": "1.0"
51+
},
52+
{
53+
"KeyCode": "CP-233863-SN",
54+
"OperationCode": "StrongNameVerify",
55+
"Parameters": {},
56+
"ToolName": "sign",
57+
"ToolVersion": "1.0"
58+
},
59+
{
60+
"KeyCode": "CP-230012",
61+
"OperationCode": "SigntoolSign",
62+
"Parameters": {
63+
"OpusName": "Microsoft",
64+
"OpusInfo": "http://www.microsoft.com",
65+
"FileDigest": "/fd \"SHA256\"",
66+
"PageHash": "/NPH",
67+
"TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
68+
},
69+
"ToolName": "sign",
70+
"ToolVersion": "1.0"
71+
},
72+
{
73+
"KeyCode": "CP-230012",
74+
"OperationCode": "SigntoolVerify",
75+
"Parameters": {},
76+
"ToolName": "sign",
77+
"ToolVersion": "1.0"
78+
}
79+
]
80+
81+
- powershell: |
82+
$(Agent.ToolsDirectory)/dotnet/dotnet msbuild build.proj /t:Pack /p:Configuration=Release /p:PackageVersion=$env:VERSION /NoLogo
83+
displayName: pack
84+
85+
- task: NuGetAuthenticate@0
86+
displayName: 'NuGet Authenticate'
87+
condition: and(succeeded(), ne(variables['publish'], 'false'))
88+
89+
- task: NuGetCommand@2
90+
displayName: 'NuGet push'
91+
condition: and(succeeded(), ne(variables['publish'], 'false'))
92+
inputs:
93+
command: push
94+
packagesToPush: 'artifacts/Package/Release/Microsoft.Azure.PowerShell.*.nupkg; !artifacts/Package/Release/*.symbols.nupkg'
95+
publishVstsFeed: public/azure-powershell
96+
97+
- powershell: |
98+
dotnet msbuild build\publish.proj /p:Configuration=Release /p:ReleaseVersion=$env:VERSION /p:CommitId=$env:Build_SourceVersion /p:GitHubAccessToken=$(Github-azuresdkci-personalaccesstoken) /NoLogo
99+
displayName: 'publish package github'
100+
condition: and(succeeded(), ne(variables['publish'], 'false'))
101+
102+
- task: PublishBuildArtifacts@1
103+
displayName: 'Publish Artifact'
104+
inputs:
105+
PathtoPublish: artifacts/Package/Release/
106+
ArtifactName: aitifacts

NuGet.config

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
<configuration>
33
<packageSources>
44
<clear />
5+
<add key="azure-powershell" value="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-powershell/nuget/v3/index.json" />
56
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
67
</packageSources>
8+
<disabledPackageSources>
9+
<clear />
10+
</disabledPackageSources>
711
</configuration>

build/publish.proj

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,12 @@
1111
</PropertyGroup>
1212

1313
<Target Name="CheckRequiredParameters">
14-
<Error Text="NuGetApiKey is not assigned a value!" Condition="'$(NuGetApiKey)' == ''" />
15-
<Error Text="GitHubAccessToken is not assigned a value!" Condition="'$(GitHubAccessToken)' == ''" />
14+
<Error Text="GitHubAccessToken is not assigned a value!" Condition="'$(GitHubAccessToken)' == ''" />
1615
<Error Text="ReleaseVersion is not assigned a value!" Condition="'$(ReleaseVersion)' == ''" />
1716
<Error Text="CommitId is not assigned a value!" Condition="'$(CommitId)' == ''" />
1817
</Target>
1918

2019
<Target Name="All">
21-
<Message Importance="high" Text="Publish: All started" />
22-
<ItemGroup>
23-
<PackagePaths Include="$(PackDir)*.nupkg" Exclude="$(PackDir)*symbols.nupkg" />
24-
</ItemGroup>
25-
<Exec Command="$(NuGet) push %(PackagePaths.FullPath) -ApiKey $(NuGetApiKey) -Source https://www.myget.org/F/azure-powershell/api/v2/package -SymbolSource https://www.myget.org/F/azure-powershell/symbols/api/v2/package -SymbolApiKey $(NuGetApiKey)" />
2620
<PropertyGroup>
2721
<!-- https://stackoverflow.com/a/41618979/294804 -->
2822
<!-- https://stackoverflow.com/a/38054505/294804 -->

0 commit comments

Comments
 (0)