|
1 | 1 | steps: |
2 | | -- bash: | |
3 | | - RELEASE_JSON=$(curl -s "https://api.github.com/repos/microsoft/kiota/releases/latest") |
4 | | - LATEST_TAG=$(echo "$RELEASE_JSON" | jq -r '.tag_name') |
5 | | - ASSET_URL=$(echo "$RELEASE_JSON" | jq -r '.assets[] | select(.name | test("linux-x64")) | .browser_download_url') |
6 | | - echo "Downloading Kiota $LATEST_TAG" |
7 | | - echo "Asset URL: $ASSET_URL" |
8 | | - curl -L "$ASSET_URL" -o kiota_download |
9 | | - mkdir -p /tmp/kiota_extract |
10 | | - if [[ "$ASSET_URL" == *.zip ]]; then |
11 | | - unzip kiota_download -d /tmp/kiota_extract |
12 | | - else |
13 | | - tar -xzf kiota_download -C /tmp/kiota_extract |
14 | | - fi |
15 | | - KIOTA_BIN=$(find /tmp/kiota_extract -name kiota -type f | head -1) |
16 | | - echo "Found Kiota binary at: $KIOTA_BIN" |
17 | | - mkdir -p "$(Build.ArtifactStagingDirectory)" |
18 | | - cp "$KIOTA_BIN" "$(Build.ArtifactStagingDirectory)/kiota" |
| 2 | +- 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 | +
|
| 22 | + New-Item -ItemType Directory -Force -Path "$(Build.ArtifactStagingDirectory)" | Out-Null |
| 23 | + Copy-Item -Path $kiotaBin.FullName -Destination (Join-Path "$(Build.ArtifactStagingDirectory)" "kiota") |
19 | 24 | displayName: 'Download latest Kiota from GitHub' |
0 commit comments