aboutsummaryrefslogtreecommitdiff
path: root/ci/install.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'ci/install.ps1')
-rw-r--r--ci/install.ps115
1 files changed, 8 insertions, 7 deletions
diff --git a/ci/install.ps1 b/ci/install.ps1
index 4c42c18..3c2a2f4 100644
--- a/ci/install.ps1
+++ b/ci/install.ps1
@@ -1,15 +1,16 @@
-param([String] $BaseUrl, [String] $ModuleName, [String] $ProjectName, [String]$FileName)
+param([String] $BaseUrl, [String] $ModuleName, [String] $ProjectName, [String]$FileName, [String]$Version)
-#get the latest file
-Invoke-WebRequest "$BaseUrl/$ModuleName/@latest" -OutFile latest.txt
-#read the file into a variable
-$latest = Get-Content latest.txt
+#random delays to space out the downloads
+$randomDelay = Get-Random -Minimum 1000 -Maximum 2000
+Start-Sleep -Milliseconds $randomDelay
+
+$_src = "$BaseUrl/$ModuleName/$Version/$ProjectName/$FileName"
#download the latest version
-Invoke-WebRequest "$BaseUrl/$ModuleName/$latest/$ProjectName/$FileName" -OutFile $FileName
+Invoke-WebRequest "$_src" -OutFile $FileName
#download latest sha256
-Invoke-WebRequest "$BaseUrl/$ModuleName/$latest/$ProjectName/$FileName.sha256" -OutFile "$FileName.sha256"
+Invoke-WebRequest "$_src.sha256" -OutFile "$FileName.sha256"
#verify the file
$hash = (Get-FileHash $FileName -Algorithm SHA256).Hash