|
1 | 1 | <?xml version="1.0" encoding="utf-8"?>
|
2 |
| -<Project ToolsVersion="14.0" DefaultTargets="All" InitialTargets="CheckApiKey" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 2 | +<Project ToolsVersion="14.0" DefaultTargets="All" InitialTargets="CheckRequiredParameters" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | 3 | <PropertyGroup>
|
4 | 4 | <Root>$(MSBuildThisFileDirectory)..\</Root>
|
5 | 5 | <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
|
6 | 6 | <Artifacts>$(Root)artifacts\</Artifacts>
|
7 | 7 | <Tools>$(Root)tools\</Tools>
|
8 | 8 | <NuGet>$(Tools)NuGet-4.7.0\nuget.exe</NuGet>
|
9 | 9 | <PackDir>$(Artifacts)Package\$(Configuration)\</PackDir>
|
| 10 | + <PowerShell>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShell> |
10 | 11 | </PropertyGroup>
|
11 | 12 |
|
12 |
| - <Target Name="CheckApiKey"> |
13 |
| - <Error Text="ApiKey is not assigned a value!" Condition="'$(ApiKey)' == ''" /> |
| 13 | + <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)' == ''" /> |
| 16 | + <Error Text="ReleaseVersion is not assigned a value!" Condition="'$(ReleaseVersion)' == ''" /> |
| 17 | + <Error Text="CommitId is not assigned a value!" Condition="'$(CommitId)' == ''" /> |
14 | 18 | </Target>
|
15 | 19 |
|
16 | 20 | <Target Name="All">
|
17 | 21 | <Message Importance="high" Text="Publish: All started" />
|
18 | 22 | <ItemGroup>
|
19 | 23 | <PackagePaths Include="$(PackDir)*.nupkg" />
|
20 | 24 | </ItemGroup>
|
21 |
| - <Exec Command="$(NuGet) push %(PackagePaths.FullPath) -ApiKey $(ApiKey) -Source https://www.myget.org/F/azure-powershell/api/v2/package" /> |
| 25 | + <Exec Command="$(NuGet) push %(PackagePaths.FullPath) -ApiKey $(NuGetApiKey) -Source https://www.myget.org/F/azure-powershell/api/v2/package" /> |
| 26 | + <PropertyGroup> |
| 27 | + <!-- https://stackoverflow.com/a/41618979/294804 --> |
| 28 | + <ReleaseCommand>[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri 'https://api.github.com/repos/Azure/azure-powershell-common/releases' -Headers @{ 'Authorization' = 'Token $(GitHubAccessToken)' } -Method Post -Body (ConvertTo-Json @{ 'tag_name' = '$(ReleaseVersion)'; 'target_commitish' = '$(CommitId)'; 'name' = '$(ReleaseVersion)'; 'body' = 'Azure PowerShell Common version $(ReleaseVersion)'; 'draft' = $false; 'prerelease' = $false })</ReleaseCommand> |
| 29 | + </PropertyGroup> |
| 30 | + <Message Importance="high" Text="Publish: Creating GitHub release" /> |
| 31 | + <Exec Command="$(PowerShell) -NonInteractive -NoLogo -NoProfile -Command "$(ReleaseCommand)"" /> |
22 | 32 | </Target>
|
23 | 33 | </Project>
|
0 commit comments