forked from AutomatedLab/AutomatedLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappveyor.yml
More file actions
133 lines (114 loc) · 5.27 KB
/
appveyor.yml
File metadata and controls
133 lines (114 loc) · 5.27 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
version: 5.0.2.{build}
image:
- Visual Studio 2017
environment:
twitApi:
secure: rYfYoYo9iG/WFkyc3Bj49V0y10dfjsWo1xrncPd1LjY=
twiApiSecure:
secure: YfqnwXIZJPqn0VGRh1c+Aapjrv7d+uXHGpZiI2j7YYcRKAvWDJxrwUnr2Qy0mSnKwPk1OGJ87butL9a8opCnwQ==
accessToken:
secure: KNxTrNc7tY0vJgx3NnuCT3DBEHdC5VUWhUyU3H5bPAp7OPWxCVB0VnVmmDcKYKT0BTHa01icm9+cQ08s2+WcbQ==
accessTokenSecret:
secure: 3UIs4ZFVKTNpi0u425qZtk4tyssfZE3M2Ur5sDEGiFtPY6I7gbrWJX+VmKNK6oup
NuGetApiKey:
secure: tAdUQmRiZ270LOPN8SwbjISLfu6ldDTw6LWvdtsk+pQR7r5bJnGrG8Ntyt87edJ/
skip_tags: true
install:
- git submodule -q update --init --recursive
assembly_info:
patch: true
file: AssemblyInfo.*
assembly_version: "{version}"
assembly_file_version: "{version}"
assembly_informational_version: "{version}"
before_build:
- nuget restore
- ps: |
Write-Host "'before_build' block"
Write-Host "Setting version number in files"
Add-AppveyorMessage -Message "Setting version number in files" -Category Information
gci -Filter *.psd1 -Recurse | foreach {(Get-Content $_.FullName -Raw) -replace "ModuleVersion += '\d\.\d\.\d\.\d'", "ModuleVersion = '$env:APPVEYOR_BUILD_VERSION'" | Out-File $_.FullName}
Write-Host "Calling build script"
.\Build.ps1
build:
project: AutomatedLab.sln
after_build:
- ps: |
Write-Host "'after_build' block"
$Params = @{
Path = $env:APPVEYOR_BUILD_FOLDER
Force = $true
Recurse = $false
Verbose = $true
}
Invoke-PSDeploy @Params # Create nuget package artifacts
Write-Host "Locating installer to push as artifact"
Add-AppveyorMessage "Locating installer to push as artifact" -Category Information
$msifile = Get-ChildItem -Recurse -Filter AutomatedLab.msi | Select-Object -First 1
Push-AppVeyorArtifact $msifile.FullName -FileName $msifile.Name -DeploymentName alinstaller
deploy:
- provider: GitHub
release: AutomatedLab-v$(appveyor_build_version)
tag: v$(appveyor_build_version)
description: 'This is an automated deployment'
auth_token:
secure: 0gI2mQ864yW9/wSMzuKz4vqrHZ8hOEWcLdxTxvcH/U13he2WSmRyNIxN7Rebersx # your encrypted token from GitHub
artifact: alinstaller # upload all NuGet packages to release assets
draft: false
prerelease: false
on:
branch: master # release from master branch only
after_deploy:
ps: |
Write-Host "'after_deploy' block"
if ( (Get-PackageProvider nuget -Erroraction SilentlyContinue).Version -lt 2.8.5.210)
{
$provParams = @{
Name = 'NuGet'
MinimumVersion = '2.8.5.210'
Force = $true
}
$null = Install-PackageProvider @provParams
$null = Import-PackageProvider @provParams
}
$mainModule = Join-Path $env:APPVEYOR_BUILD_FOLDER 'AutomatedLab\AutomatedLab.dll'
$sourceLibraryPath = Join-Path $env:APPVEYOR_BUILD_FOLDER 'LabXml\Bin\debug\AutomatedLab.dll'
if(-not (Test-Path $mainModule))
{
Copy-Item $sourceLibraryPath $mainModule -Force
}
foreach ($m in (Get-ChildItem -Path $env:APPVEYOR_BUILD_FOLDER -Directory -Exclude AutomatedLab.Common))
{
if (-not ($m | Get-ChildItem -Filter *.psm1)) { continue }
$publishParams = @{
Path = $m.FullName
NuGetApiKey = $env:NuGetApiKey
Repository = 'PSGallery'
Force = $true
Confirm = $false
}
write-Host "Publishing module '$($m.FullName)'"
Start-Job -Name "Publish $m" -ScriptBlock {
$publishParams = $args[0]
Publish-Module @publishParams
} -ArgumentList $publishParams | Receive-Job -AutoRemoveJob -Wait
}
<#Write-Host "Downloading Twitter module"
iex (New-Object Net.WebClient).DownloadString("https://gist.githubusercontent.com/stefanstranger/2138dc710576bc40b64b/raw/bfd25a0e7363e9a1906908b0695ebcffaa508276/InstallMyTwitterModule.ps1")
if (Get-Module MyTwitter -List)
{
New-MyTwitterConfiguration -APIKey $env:twitApi -APISecret $env:twiApiSecure -AccessToken $env:accessToken -AccessTokenSecret $env:accessTokenSecret -Force -Verbose:$false
$tweets = @(
"#AutomatedLab just released v{0}! See our changelog at: {1} Get it while it's hot! #PowerShell #Automation"
"It's time for a new release :) #AutomatedLab v{0} is out now! Check out what has changed: {1} #PowerShell #Automation"
"#AutomatedLab v{0} is now live! Check out our changelog at {1}! #PowerShell #Automation"
"What? AutomatedLab has released v{0}? Awesome :) Check out our changelog at {1}! #PowerShell #Automation"
)
$rnd = Get-Random -Minimum 0 -Maximum ($tweets.Length -1)
#[void] (Send-Tweet -Message ($tweets[$rnd] -f $env:APPVEYOR_BUILD_VERSION, 'https://github.com/AutomatedLab/AutomatedLab/blob/develop/CHANGELOG.md'))
}#>
on_finish:
- ps: |
Write-Host "'on_finish' block"
#$blockRdp = $true
#iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))