-
Notifications
You must be signed in to change notification settings - Fork 0
/
getLTA.ps1
58 lines (49 loc) · 1.76 KB
/
getLTA.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#getLTA.ps1
param(
[parameter(Mandatory = $false)]
[string]$License,
[parameter(Mandatory = $false)]
[string]$RunnerOs
)
if ($RunnerOs -eq 'Linux')
{
$LemonTreePackageURL = "https://nexus.lieberlieber.com/repository/lemontree-release/LemonTree.Automation/LemonTree.Automation.Linux.Zip_latest.zip"
}
elseif ($RunnerOs -eq 'Windows')
{
# somehow nexus is super slow on windows-latest
# $LemonTreePackageURL = "https://nexus.lieberlieber.com/repository/lemontree-release/LemonTree.Automation/LemonTree.Automation.Windows.Zip_latest.zip"
$LemonTreePackageURL = "https://www.lieberlieber.com/lemontree/automation/latest"
}
else
{
Write-Output '$RunnerOs is not supported'
Exit -1
}
Write-Output "Download LemonTree.Automtion from Repo"
# while (Test-Path Alias:curl) {Remove-Item Alias:curl} #remove the alias binding from curl to Invoke-WebRequest
# curl "$LemonTreePackageURL" --output LTA.zip -k
Invoke-WebRequest -URI "$LemonTreePackageURL" -OutFile "LTA.zip"
Expand-Archive "LTA.zip" -DestinationPath ".\LTA\" -Force
if([string]::IsNullOrWhiteSpace($License))
{
Write-Output "No License info provided."
}
else
{
Write-Output "Create License File from provided info"
$License | Out-File -FilePath lta.lic #if you deploy the license on the fly
}
if ($RunnerOs -eq 'Linux')
{
$LemonTreeExe = "./LTA/LemonTree.Automation"
#workaround because github artifacts logic doesn't maintain properties
chmod +x $LemonTreeExe
}
elseif ($RunnerOs -eq 'Windows')
{
$LemonTreeExe = ".\LTA\LemonTree.Automation.exe"
}
#Just to be sure if the executeable is not available - let's throw exitcode 1
Write-Output "LemonTreeAutomationExecutable=$LemonTreeExe" >> $env:GITHUB_OUTPUT
exit 0