1
+ version : ' {build}'
2
+ environment :
3
+ UnitsNetPfxEncSecret :
4
+ secure : hU9+bykqjFP/sx5GWxRofg==
5
+ UnitsNetPfxSecret :
6
+ secure : Dibuvlff8E8XYIVHZFh+y632RN23ZamvKEJE9NNf/GM=
7
+ install :
8
+ - ps : >-
9
+ Write-Host -ForegroundColor Yellow "Install 'secure-file' tool..."
10
+ nuget install secure-file -ExcludeVersion
11
+
12
+ Write-Host -ForegroundColor Yellow "Decrypt UnitsNet.pfx..."
13
+ .\secure-file\tools\secure-file -decrypt Build\UnitsNet.pfx.enc -secret $env:UnitsNetPfxEncSecret
14
+
15
+ $pfx = Resolve-Path "Build\UnitsNet.pfx"
16
+ $password = $env:UnitsNetPfxSecret
17
+ $keyContainerName = "VS_KEY_53797375DF3695DD"
18
+
19
+
20
+ # Import certificate
21
+
22
+ Write-Host -ForegroundColor Yellow "Import $pfx ..."
23
+
24
+ $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
25
+ $cert.Import($pfx, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
26
+ $exportPrivateKeyInformation = $true
27
+ $certXml = $cert.PrivateKey.ToXmlString($exportPrivateKeyInformation)
28
+
29
+ $csp = New-Object System.Security.Cryptography.CspParameters
30
+ $csp.KeyContainerName = $keyContainerName
31
+ $csp.Flags = [System.Security.Cryptography.CspProviderFlags]::UseMachineKeyStore -bor [System.Security.Cryptography.CspProviderFlags]::NoPrompt # -bor is biwise or
32
+ $csp.KeyNumber = [System.Security.Cryptography.KeyNumber]::Signature
33
+
34
+ $rsa = New-Object System.Security.Cryptography.RSACryptoServiceProvider $csp
35
+ $rsa.FromXmlString($certXml)
36
+ $rsa.Clear()
37
+
38
+ Write-Host -ForegroundColor Yellow "Sucesfully imported $pfx into StrongName CSP store"
39
+ build_script :
40
+ - ps : >-
41
+ #####################################
42
+ # Build, test, pack and deploy nugets
43
+ #####################################
44
+
45
+ pushd Build
46
+ .\\build.bat %CD%\\UnitsNet.pfx
47
+ popd
48
+
49
+ #####################################
50
+ # Upload test results to AppVeyor
51
+ #####################################
52
+
53
+ $wc = New-Object 'System.Net.WebClient'
54
+
55
+ Get-ChildItem .\\Artifacts\\Logs\\*Test*.xml | %{
56
+ $wc.UploadFile(\"https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)\", $_.FullName)
57
+ }
58
+ test : off
59
+ artifacts :
60
+ - path : Artifacts\UnitsNet.zip
61
+ name : UnitsNet.zip
62
+ deploy :
63
+ - provider : NuGet
64
+ api_key :
65
+ secure : 4E0S7bjDLDdCCLtRqD0mMXTg5pOwppHWS5C77acZ9HpvaN8rGmwn6ANfLrAUxxF+
66
+ on :
67
+ branch : master
0 commit comments