Publish Github release (#432)
This commit is contained in:
Родитель
46fb310c7f
Коммит
7768c6fce3
|
@ -0,0 +1,27 @@
|
|||
param($Token, $BuildNumber, $Sha, $WorkingDirectory, $PackageJson)
|
||||
|
||||
$WorkingDirectory = Resolve-Path $WorkingDirectory
|
||||
|
||||
cp $PackageJson $WorkingDirectory -Force
|
||||
|
||||
pushd $WorkingDirectory
|
||||
try
|
||||
{
|
||||
$currentVersion = node -p -e "require('./package.json').version";
|
||||
$devVersion="$currentVersion-dev.$BuildNumber"
|
||||
|
||||
Write-Host "Setting version to $devVersion"
|
||||
|
||||
npm version --no-git-tag-version $devVersion > Out-Null;
|
||||
|
||||
$file = npm pack -q;
|
||||
$name = [System.IO.Path]::GetFileNameWithoutExtension($file)
|
||||
|
||||
Write-Host "Publishing $file"
|
||||
|
||||
cmd /c "npx -q publish-release --token $Token --repo autorest.csharp --owner azure --name $name --tag $devVersion --notes=prerelease-build --prerelease --editRelease false --assets $file --target_commitish $Sha 2>&1"
|
||||
}
|
||||
finally
|
||||
{
|
||||
popd
|
||||
}
|
|
@ -38,11 +38,8 @@ jobs:
|
|||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
||||
DOTNET_MULTILEVEL_LOOKUP: 0
|
||||
- script: |
|
||||
dotnet pack /t:NpmPackage src/AutoRest.CSharp.V3/AutoRest.CSharp.V3.csproj -o $(Build.ArtifactStagingDirectory)
|
||||
displayName: "Publish NPM package"
|
||||
- task: PublishPipelineArtifact@1
|
||||
condition: succeeded()
|
||||
inputs:
|
||||
artifactName: packages
|
||||
path: $(Build.ArtifactStagingDirectory)
|
||||
- ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))}}:
|
||||
- pwsh: ./eng/PublishRelease.ps1 -WorkingDirectory ./artifacts/bin/AutoRest.CSharp.V3/Debug/netcoreapp3.0/ -PackageJson ./src/AutoRest.CSharp.V3/package.json -Token $(Github-azuresdkci-personalaccesstoken) -Artifacts $(Build.ArtifactStagingDirectory) -BuildNumber $(Build.BuildNumber) -Sha $(Build.SourceVersion)
|
||||
condition: succeeded()
|
||||
failOnStderr: false
|
||||
displayName: 'Publish to GitHub'
|
||||
|
|
|
@ -26,20 +26,5 @@
|
|||
<None Include="package.json" CopyToOutputDirectory="PreserveNewest" />
|
||||
<None Include="../../readme.md" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="NpmPackage" DependsOnTargets="Build">
|
||||
<Exec Command="npm pack" WorkingDirectory="$(OutputPath)" ConsoleToMsBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfPack" />
|
||||
</Exec>
|
||||
|
||||
<ItemGroup>
|
||||
<OutputOfPackLines Include="$(OutputOfPack)" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<NpmPackageName Condition="'%(OutputOfPackLines.Identity)' != ''">%(OutputOfPackLines.Identity)</NpmPackageName>
|
||||
</PropertyGroup>
|
||||
|
||||
<Message Importance="high" Text="$(NpmPackageName) -> $(PackageOutputPath)" />
|
||||
<Copy SourceFiles="$(OutputPath)$(NpmPackageName)" DestinationFolder="$(PackageOutputPath)" Retries="5" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
Загрузка…
Ссылка в новой задаче