Forked from MarkTiedemann/download-latest-release.ps1
Created
September 10, 2021 07:09
-
-
Save jlawhon/8e36f73ea31075a07eef05c52e2e3fd7 to your computer and use it in GitHub Desktop.
Revisions
-
MarkTiedemann revised this gist
Mar 31, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ $releases = "https://api.github.com/repos/$repo/releases" Write-Host Determining latest release $tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name $download = "https://github.com/$repo/releases/download/$tag/$file" $name = $file.Split(".")[0] $zip = "$name-$tag.zip" $dir = "$name-$tag" -
MarkTiedemann created this gist
Mar 31, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ # Download latest dotnet/codeformatter release from github $repo = "dotnet/codeformatter" $file = "CodeFormatter.zip" $releases = "https://api.github.com/repos/$repo/releases" Write-Host Determining latest release $tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name $download = "https://github.com/dotnet/codeformatter/releases/download/$tag/$file" $name = $file.Split(".")[0] $zip = "$name-$tag.zip" $dir = "$name-$tag" Write-Host Dowloading latest release Invoke-WebRequest $download -Out $zip Write-Host Extracting release files Expand-Archive $zip -Force # Cleaning up target dir Remove-Item $name -Recurse -Force -ErrorAction SilentlyContinue # Moving from temp dir to target dir Move-Item $dir\$name -Destination $name -Force # Removing temp files Remove-Item $zip -Force Remove-Item $dir -Recurse -Force