Skip to content

Commit 11eceaf

Browse files
authored
Merge branch 'develop' into update-directory
2 parents aad104d + 5d27ca0 commit 11eceaf

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

build/publish.proj

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
11
<?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">
33
<PropertyGroup>
44
<Root>$(MSBuildThisFileDirectory)..\</Root>
55
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
66
<Artifacts>$(Root)artifacts\</Artifacts>
77
<Tools>$(Root)tools\</Tools>
88
<NuGet>$(Tools)NuGet-4.7.0\nuget.exe</NuGet>
99
<PackDir>$(Artifacts)Package\$(Configuration)\</PackDir>
10+
<PowerShell>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShell>
1011
</PropertyGroup>
1112

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)' == ''" />
1418
</Target>
1519

1620
<Target Name="All">
1721
<Message Importance="high" Text="Publish: All started" />
1822
<ItemGroup>
1923
<PackagePaths Include="$(PackDir)*.nupkg" />
2024
</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 &quot;$(ReleaseCommand)&quot;" />
2232
</Target>
2333
</Project>

0 commit comments

Comments
 (0)