Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write output of sign install to log #1270

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Actions/Packages.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sign": "0.9.1-beta.24123.2",
"sign": "0.9.1-beta.24469.1",
"Microsoft.ApplicationInsights": "2.20.0",
"Az.Accounts": "2.15.1",
"Az.Storage": "6.1.1",
Expand Down
23 changes: 21 additions & 2 deletions Actions/Sign/Sign.psm1
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<#
.SYNOPSIS
Checks whether nuget.org is added as a nuget source.
#>
function AssertNugetSourceIsAdded() {
$nugetSource = "https://api.nuget.org/v3/index.json"
$nugetSourceExists = dotnet nuget list source | Select-String -Pattern $nugetSource
if (-not $nugetSourceExists) {
throw "Nuget source $nugetSource is not added. Please add the source using 'dotnet nuget add source $nugetSource' or add another source with nuget.org as an upstream source."
}
}

<#
.SYNOPSIS
Installs the dotnet signing tool.
Expand All @@ -16,10 +28,17 @@ function Install-SigningTool() {
# Install the signing tool in the temp folder
Write-Host "Installing signing tool version $version in $tempFolder"
New-Item -ItemType Directory -Path $tempFolder | Out-Null
dotnet tool install sign --version $version --tool-path $tempFolder | Out-Null
dotnet tool install sign --version $version --tool-path $tempFolder | Out-Host

# Return the path to the signing tool
$signingTool = Join-Path -Path $tempFolder "sign.exe" -Resolve
$signingTool = Join-Path -Path $tempFolder "sign.exe"
if (-not (Test-Path -Path $signingTool)) {
# Check if nuget.org is added as a nuget source
AssertNugetSourceIsAdded

# If the tool is not found, throw an error
throw "Failed to install signing tool. If you are using a self-hosted runner please make sure you've followed all the steps described in https://aka.ms/algosettings#runs-on."
}
return $signingTool
}

Expand Down
Loading