Skip to content

Instantly share code, notes, and snippets.

@MIchaelMainer
Created January 3, 2020 22:38
Show Gist options
  • Save MIchaelMainer/26ad1d021de4f51990c461619ee59929 to your computer and use it in GitHub Desktop.
Save MIchaelMainer/26ad1d021de4f51990c461619ee59929 to your computer and use it in GitHub Desktop.
# Assuming the latest release always has typewriter.exe/
# Get information about the GitHub releases.
$feedQuery = 'https://api.github.com/repos/microsoftgraph/MSGraph-SDK-Code-Generator/releases'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$jsonObject = Invoke-WebRequest -Uri $feedQuery | ConvertFrom-Json
# GitHub release API provides the latest
if ($jsonObject.assets[0].name -eq 'typewriter.zip') {
$downloadURL = $jsonObject.assets[0].browser_download_url
Invoke-WebRequest -Uri $downloadURL -OutFile 'typewriter.zip'
}
else {
Write-Error 'typewriter.zip was not found.'
}
# Unzip and move typewriter.exe to the present working directory.
Expand-Archive .\typewriter.zip -Force
Move-Item .\typewriter\Release\* $PWD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment