Skip to content

Commit d2e8686

Browse files
committed
download using dotnet tool
1 parent b3c9ccc commit d2e8686

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed
Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
11
steps:
22
- pwsh: |
3-
$releaseJson = Invoke-RestMethod "https://api.github.com/repos/microsoft/kiota/releases/latest"
4-
$latestTag = $releaseJson.tag_name
5-
$asset = $releaseJson.assets | Where-Object { $_.name -match "linux-x64" } | Select-Object -First 1
6-
Write-Host "Downloading Kiota $latestTag"
7-
Write-Host "Asset URL: $($asset.browser_download_url)"
8-
9-
$extractDir = Join-Path ([System.IO.Path]::GetTempPath()) "kiota_extract_$([System.IO.Path]::GetRandomFileName())"
10-
New-Item -ItemType Directory -Force -Path $extractDir | Out-Null
11-
$downloadPath = Join-Path $extractDir "kiota_download.zip"
12-
13-
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $downloadPath
14-
Expand-Archive -Path $downloadPath -DestinationPath $extractDir -Force
15-
16-
Write-Host "=== Extracted contents ==="
17-
Get-ChildItem $extractDir -Recurse | Select-Object FullName
18-
19-
$kiotaBin = Get-ChildItem -Path $extractDir -Recurse -File | Where-Object { $_.BaseName -eq "kiota" } | Select-Object -First 1
20-
Write-Host "Found Kiota binary at: $($kiotaBin.FullName)"
21-
3+
dotnet tool install --global Microsoft.OpenApi.Kiota
4+
$kiotaPath = Join-Path $HOME ".dotnet" "tools" "kiota"
5+
Write-Host "Kiota installed at: $kiotaPath"
226
New-Item -ItemType Directory -Force -Path "$(Build.ArtifactStagingDirectory)" | Out-Null
23-
Copy-Item -Path $kiotaBin.FullName -Destination (Join-Path "$(Build.ArtifactStagingDirectory)" "kiota")
24-
displayName: 'Download latest Kiota from GitHub'
7+
Copy-Item -Path $kiotaPath -Destination (Join-Path "$(Build.ArtifactStagingDirectory)" "kiota")
8+
displayName: 'Install Kiota via dotnet tool'

0 commit comments

Comments
 (0)