-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-module.ps1
More file actions
19 lines (19 loc) · 900 Bytes
/
Copy pathdeploy-module.ps1
File metadata and controls
19 lines (19 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if ($IsLinux) {
$path = ($env:PSModulePath.Split(":")[0])+"/Console-Translate"
} else {
$path = ($env:PSModulePath.Split(";")[0])+"\Console-Translate"
}
if (Test-Path $path) {
Remove-Item "$path\" -Recurse
}
$GitHub_Tag = (Invoke-RestMethod "https://api.github.com/repos/Lifailon/Console-Translate/releases/latest").tag_name
$Module_Path = "$path/$GitHub_Tag"
New-Item -Path $Module_Path -Force -ItemType Directory
$url = "https://api.github.com/repos/Lifailon/Console-Translate/contents/Console-Translate/$GitHub_Tag"
$Files_GitHub = Invoke-RestMethod -Uri $url
foreach ($File_GitHub in $Files_GitHub) {
$File_Name = $File_GitHub.name
$Url_Download = $File_GitHub.download_url
#(New-Object Net.WebClient).DownloadString($Url_Download) | Out-File "$Module_Path\$File_Name" -Encoding default -Force
Invoke-RestMethod -Uri $Url_Download -OutFile "$Module_Path\$File_Name"
}