Created
March 13, 2020 23:47
-
-
Save onesmartguy/b72edcc38a858acfc9565f809dd48b18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parameters: | |
packages: '' | |
options: '-y --no-progress --limitoutput' | |
steps: | |
- powershell: | | |
if ((Get-Command "choco.exe" -ErrorAction SilentlyContinue) -eq $null) { | |
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString("https://chocolatey.org/install.ps1")) | |
echo "##vso[task.setvariable variable=PATH]$env:PATH" | |
echo $env:PATH | |
} else { | |
echo "choco already installed" | |
} | |
displayName: 'Install choco' | |
condition: and(ne(variables.hasChanges, 'false'), ne(variables.hasChanges, False)) | |
- ${{ if ne(parameters.packages, '') }}: | |
- powershell: | | |
choco install ${{ parameters.options }} ${{ parameters.packages }} | |
if ($lastexitcode -ne 0) { | |
get-content -path "C:\ProgramData\chocolatey\logs\chocolatey.log" | |
throw | |
} | |
displayName: "Install choco packages" | |
condition: and(ne(variables.hasChanges, 'false'), ne(variables.hasChanges, False)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment