Created
January 3, 2020 22:38
-
-
Save MIchaelMainer/26ad1d021de4f51990c461619ee59929 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# 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