-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpublish.ps1
executable file
·65 lines (51 loc) · 1.92 KB
/
publish.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
59
60
61
62
63
64
65
#!/usr/bin/pwsh
function Invoke-TlkPublish {
param(
[string] $ConanRemoteName,
[string] $ConanRemoteUrl,
[string] $ConanUsername,
[string] $ConanPassword
)
if (-Not [string]::IsNullOrEmpty($ConanRemoteName)) {
$Env:CONAN_REMOTE_NAME = $ConanRemoteName
}
if (-Not [string]::IsNullOrEmpty($ConanRemoteUrl)) {
$Env:CONAN_REMOTE_URL = $ConanRemoteUrl
}
if (-Not [string]::IsNullOrEmpty($ConanUsername)) {
$Env:CONAN_LOGIN_USERNAME = $ConanUsername
}
if (-Not [string]::IsNullOrEmpty($ConanPassword)) {
$Env:CONAN_PASSWORD = $ConanPassword
}
if (-Not (Test-Path Env:CONAN_REMOTE_NAME)) {
throw "CONAN_REMOTE_NAME environment variable must be set"
}
if (-Not (Test-Path Env:CONAN_REMOTE_URL)) {
throw "CONAN_REMOTE_URL environment variable must be set"
}
if (-Not (Test-Path Env:CONAN_LOGIN_USERNAME)) {
throw "CONAN_LOGIN_USERNAME environment variable must be set"
}
if (-Not (Test-Path Env:CONAN_PASSWORD)) {
throw "CONAN_PASSWORD environment variable must be set"
}
$Env:CONAN_NON_INTERACTIVE = "1"
$tarballs = Get-ChildItem . -Filter "*.tar.gz" -Recurse
$tarballs | ForEach-Object {
if (-Not (Test-Path $(Join-Path $_.Directory '.conan'))) {
tar -xf $_.FullName -C $_.Directory
}
}
$ConanCaches = Get-ChildItem . -Filter ".conan" -Hidden -Recurse
$ConanCaches | ForEach-Object {
$ConanUserHome = $_.Parent
$CacheName = $ConanUserHome.Name
Write-Host "Uploading $CacheName cache"
$Env:CONAN_USER_HOME="$ConanUserHome"
conan remote add $Env:CONAN_REMOTE_NAME $Env:CONAN_REMOTE_URL --force
conan user $Env:CONAN_LOGIN_USERNAME -r $Env:CONAN_REMOTE_NAME -p
conan upload *@devolutions/stable --all --parallel -r $Env:CONAN_REMOTE_NAME -c
}
}
Invoke-TlkPublish @args