Path: blob/main/build/azure-pipelines/distro/download-distro.yml
3520 views
steps:1- task: AzureKeyVault@22displayName: "Azure Key Vault: Get Secrets"3inputs:4azureSubscription: vscode5KeyVaultName: vscode-build-secrets6SecretsFilter: "github-distro-mixin-password"78# TODO@joaomoreno: Keep pwsh once we move out of running entire jobs in containers9- pwsh: |10"machine github.com`nlogin vscode`npassword $(github-distro-mixin-password)" | Out-File "$Home/_netrc" -Encoding ASCII11condition: and(succeeded(), contains(variables['Agent.OS'], 'windows'))12displayName: Setup distro auth (Windows)1314- pwsh: |15$ErrorActionPreference = "Stop"16$ArchivePath = "$(Agent.TempDirectory)/distro.zip"17$PackageJson = Get-Content -Path package.json -Raw | ConvertFrom-Json18$DistroVersion = $PackageJson.distro1920Invoke-WebRequest -Uri "https://api.github.com/repos/microsoft/vscode-distro/zipball/$DistroVersion" `21-OutFile $ArchivePath `22-Headers @{ "Accept" = "application/vnd.github+json"; "Authorization" = "Bearer $(github-distro-mixin-password)"; "X-GitHub-Api-Version" = "2022-11-28" }2324New-Item -ItemType Directory -Path .build -Force25Expand-Archive -Path $ArchivePath -DestinationPath .build26Rename-Item -Path ".build/microsoft-vscode-distro-$DistroVersion" -NewName distro27condition: and(succeeded(), contains(variables['Agent.OS'], 'windows'))28displayName: Download distro (Windows)2930- script: |31mkdir -p .build32cat << EOF | tee ~/.netrc .build/.netrc > /dev/null33machine github.com34login vscode35password $(github-distro-mixin-password)36EOF37condition: and(succeeded(), not(contains(variables['Agent.OS'], 'windows')))38displayName: Setup distro auth (non-Windows)3940- script: |41set -e42ArchivePath="$(Agent.TempDirectory)/distro.zip"43DistroVersion=$(node -p "require('./package.json').distro")4445curl -H "Accept: application/vnd.github+json" \46-H "Authorization: Bearer $(github-distro-mixin-password)" \47-H "X-GitHub-Api-Version: 2022-11-28" \48-o $ArchivePath \49-L "https://api.github.com/repos/microsoft/vscode-distro/zipball/$DistroVersion"5051unzip $ArchivePath -d .build52mv .build/microsoft-vscode-distro-$DistroVersion .build/distro53condition: and(succeeded(), not(contains(variables['Agent.OS'], 'windows')))54displayName: Download distro (non-Windows)555657