winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 2a6095cf582f7e2f19fe04322ee11875e011cb8b
parent 3a94abd45168a56a9a737f0d14f987e7b36a0661
Author: Union Palenshus <palenshus@users.noreply.github.com>
Date:   Mon,  8 Feb 2021 12:41:20 -0800

Azure pipeline to generate and publish Microsoft.WindowsPackageManager.Utils nuget package (#741)


Diffstat:
M.github/actions/spelling/allow.txt | 6++++++
M.github/actions/spelling/patterns.txt | 10++++++++++
AWinGetUtil.nuspec | 21+++++++++++++++++++++
Aazure-pipelines.nuget.yml | 143+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mazure-pipelines.yml | 2++
Msrc/binver/Update-BinVer.ps1 | 29++++++++++++++++++++---------
6 files changed, 202 insertions(+), 9 deletions(-)

diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt @@ -93,6 +93,7 @@ ENU enum errorlevel errstr +esrp etag ETW EVENTTAG @@ -193,6 +194,7 @@ mday metadata microsoft mimetype +Minimatch MINORVERSION monostate motw @@ -232,6 +234,8 @@ NTSTATUS nuget nullptr nullsoft +nupkg +nuspec nunit OAuth ofstream @@ -242,6 +246,7 @@ ostringstream OSVERSIONINFOEXW outfile OUTOFMEMORY +Params parentidx pathpart Pathto @@ -295,6 +300,7 @@ rowcount rowid rubengustorage runsettings +runtimes safecast savepoint SCROLLER diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt @@ -20,3 +20,13 @@ El proyecto .* diferentes \b[-.A-Za-z0-9]+_[a-z0-9]{13}\b # Locales for name normalization \b\p{Lu}{2,3}(?:-(?:CANS|CYRL|LATN|MONG))?-\p{Lu}{2}(?![A-Z])(?:-VALENCIA)?\b +# Azure pipeline tasks +- task: .* + +# Slash-prefixed patterns +\\native(?![a-z]) +/NPH(?![a-z]) +/td(?![a-z]) + +# URLs -- Added here instead of allow.txt to facilitate wildcarding them as more are added +http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer diff --git a/WinGetUtil.nuspec b/WinGetUtil.nuspec @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<package > + <metadata> + <id>Microsoft.WindowsPackageManager.Utils</id> + <version>$version$</version> + <title></title> + <authors>Microsoft</authors> + <owners></owners> + <projectUrl>https://github.com/microsoft/winget-cli</projectUrl> + <license type="expression">MIT</license> + <requireLicenseAcceptance>true</requireLicenseAcceptance> + <description>The utility binary for use with the WinGet CLI.</description> + <copyright>© Microsoft Corporation. All rights reserved.</copyright> + <tags>winget</tags> + </metadata> + <files> + <file src="src\x64\Release\WinGetUtil\WinGetUtil.dll" target="runtimes\win-x64\native\WinGetUtil.dll"/> + <file src="src\x86\Release\WinGetUtil\WinGetUtil.dll" target="runtimes\win-x86\native\WinGetUtil.dll"/> + </files> +</package>+ \ No newline at end of file diff --git a/azure-pipelines.nuget.yml b/azure-pipelines.nuget.yml @@ -0,0 +1,143 @@ +trigger: none + +parameters: + - name: version + displayName: Version to stamp on binaries and nuget package. Should be in form of "major.minor", for example "1.0" + type: string + +pool: + vmImage: "windows-latest" + +variables: + solution: "src/AppInstallerCLI.sln" + buildConfiguration: "Release" + packageName: Microsoft.WindowsPackageManager.Utils + +jobs: + - job: "Build" + variables: + BuildVer: $[counter(${{ parameters.version }}, 1)] + version: ${{ parameters.version }}.$(BuildVer) + steps: + - script: echo $(version) + + - task: NuGetToolInstaller@1 + displayName: Install Nuget + + # Restores all projects, including native (vcxproj) projects + - task: NuGetCommand@2 + displayName: Restore Packages + inputs: + restoreSolution: "$(solution)" + + # Restores only .NET core projects, but is still necessary, as without this the IndexCreationTool and LocalhostWebServer projects fail to build + - task: DotNetCoreCLI@2 + displayName: DotNet Restore + inputs: + command: "restore" + projects: "**/*.csproj" + + - task: PowerShell@2 + displayName: Update Binary Version + condition: not(eq(variables['Build.Reason'], 'PullRequest')) + inputs: + filePath: 'src\binver\Update-BinVer.ps1' + arguments: '-TargetFile binver\binver\version.h -BuildVersion $(BuildVer) -MajorMinorOverride ${{ parameters.version }}' + workingDirectory: "src" + + - task: VSBuild@1 + displayName: Build Solution x86 + inputs: + platform: "x86" + solution: "$(solution)" + configuration: "$(buildConfiguration)" + + - task: VSBuild@1 + displayName: Build Solution x64 + inputs: + platform: "x64" + solution: "$(solution)" + configuration: "$(buildConfiguration)" + + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: "ESRP CodeSigning - Package contents" + inputs: + ConnectedServiceName: "WindowsPackageManager ESRP CodeSigning" + FolderPath: src + Pattern: | + *\$(buildConfiguration)\WinGetUtil\WinGetUtil.dll + UseMinimatch: true + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "KeyCode" : "CP-230012", + "OperationCode" : "SigntoolSign", + "Parameters" : { + "OpusName" : "Microsoft", + "OpusInfo" : "http://www.microsoft.com", + "FileDigest" : "/fd \"SHA256\"", + "PageHash" : "/NPH", + "TimeStamp" : "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + }, + "ToolName" : "sign", + "ToolVersion" : "1.0" + }, + { + "KeyCode" : "CP-230012", + "OperationCode" : "SigntoolVerify", + "Parameters" : {}, + "ToolName" : "sign", + "ToolVersion" : "1.0" + } + ] + + - task: NuGetCommand@2 + displayName: Pack WingetUtil nuget package + inputs: + command: pack + packagesToPack: WinGetUtil.nuspec + versioningScheme: byEnvVar + versionEnvVar: version + packDestination: "$(Build.ArtifactStagingDirectory)" + + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: "ESRP CodeSigning - NuGet package" + inputs: + ConnectedServiceName: "WindowsPackageManager ESRP CodeSigning" + FolderPath: "$(Build.ArtifactStagingDirectory)" + Pattern: "Microsoft.Packaging.WinGetUtil.$(version).nupkg" + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "KeyCode" : "CP-401405", + "OperationCode" : "NuGetSign", + "Parameters" : {}, + "ToolName" : "sign", + "ToolVersion" : "1.0" + }, + { + "KeyCode" : "CP-401405", + "OperationCode" : "NuGetVerify", + "Parameters" : {}, + "ToolName" : "sign", + "ToolVersion" : "1.0" + } + ] + + - task: PublishBuildArtifacts@1 + displayName: Publish nuget package to artifacts + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(packageName).$(version).nupkg' + ArtifactName: $(packageName) + publishLocation: Container + + - task: NuGetCommand@2 + displayName: Push WingetUtil nuget package to nuget.org + inputs: + command: push + nuGetFeedType: external + includeNugetOrg: true + packagesToPush: '$(Build.ArtifactStagingDirectory)\$(packageName).$(version).nupkg' + publishFeedCredentials: "WindowsPackageManagerAzurePipelineNuget - NuGet.org" diff --git a/azure-pipelines.yml b/azure-pipelines.yml @@ -47,11 +47,13 @@ jobs: - task: NuGetToolInstaller@1 displayName: Install Nuget + # Restores all projects, including native (vcxproj) projects - task: NuGetCommand@2 displayName: Restore Packages inputs: restoreSolution: '$(solution)' + # Restores only .NET core projects, but is still necessary, as without this the IndexCreationTool and LocalhostWebServer projects fail to build - task: DotNetCoreCLI@2 displayName: DotNet Restore inputs: diff --git a/src/binver/Update-BinVer.ps1 b/src/binver/Update-BinVer.ps1 @@ -18,25 +18,36 @@ param( [Parameter(Mandatory=$false)] [int]$BuildVersion = 0, + [Parameter(Mandatory=$false)] + [string]$MajorMinorOverride, + [switch]$OutVar ) -$ErrorActionPreference = 'SilentlyContinue' -$Local:GitDescribeText = git describe --tags; -$ErrorActionPreference = 'Continue' -Write-Host "Git describe: $Local:GitDescribeText" - $Local:Major = 0; $Local:Minor = 0; -if ($Local:GitDescribeText -match "v([0-9]+)\.([0-9]+)") +if ($MajorMinorOverride -match "([0-9]+)\.([0-9]+)") { $Local:Major = $Matches[1] $Local:Minor = $Matches[2] } -else -{ - Write-Host "Describe did not match regex; using zeros" +else { + $ErrorActionPreference = 'SilentlyContinue' + $Local:GitDescribeText = git describe --tags; + $ErrorActionPreference = 'Continue' + + Write-Host "Git describe: $Local:GitDescribeText" + + if ($Local:GitDescribeText -match "v([0-9]+)\.([0-9]+)") + { + $Local:Major = $Matches[1] + $Local:Minor = $Matches[2] + } + else + { + Write-Host "Describe did not match regex and major/minor weren't explicitly provided; using zeros" + } } Write-Host "Using version: $Local:Major.$Local:Minor.$BuildVersion"