diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 8c29d1559..945e79740 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -370,6 +370,12 @@ "{{ template_dir }}/scripts/Installers/Install-Git.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-GitHub-CLI.ps1" + ] + }, { "type": "powershell", "environment_vars": [ @@ -719,6 +725,12 @@ "{{ template_dir }}/scripts/Installers/Validate-Git.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-GitHub-CLI.ps1" + ] + }, { "type": "powershell", "environment_vars": [ diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index deecbe6f6..aa008e02e 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -343,6 +343,12 @@ "{{ template_dir }}/scripts/Installers/Install-Git.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-GitHub-CLI.ps1" + ] + }, { "type": "powershell", "environment_vars": [ @@ -716,6 +722,12 @@ "{{ template_dir }}/scripts/Installers/Validate-Git.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-GitHub-CLI.ps1" + ] + }, { "type": "powershell", "environment_vars": [ diff --git a/images/win/scripts/Installers/Install-GitHub-CLI.ps1 b/images/win/scripts/Installers/Install-GitHub-CLI.ps1 new file mode 100644 index 000000000..5fb49887a --- /dev/null +++ b/images/win/scripts/Installers/Install-GitHub-CLI.ps1 @@ -0,0 +1,10 @@ +################################################################################ +## File: Install-GitHub-CLI.ps1 +## Desc: Install GitHub CLI +################################################################################ + +Import-Module -Name ImageHelpers -Force + +Choco-Install -PackageName gh + +Add-MachinePathItem "C:\Program Files (x86)\GitHub CLI" \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-GitHub-CLI.ps1 b/images/win/scripts/Installers/Validate-GitHub-CLI.ps1 new file mode 100644 index 000000000..fa9f2bf1f --- /dev/null +++ b/images/win/scripts/Installers/Validate-GitHub-CLI.ps1 @@ -0,0 +1,27 @@ +################################################################################ +## File: Validate-GitHub-CLI.ps1 +## Desc: Validate GitHub CLI +################################################################################ + +$command = Get-Command -Name 'gh' + +if ($command) +{ + Write-Host "gh on path" +} +else +{ + Write-Host 'gh is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "GitHub CLI" + +$version = (gh --version).Split()[2] + +$Description = @" +_Version:_ $version
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file