summaryrefslogtreecommitdiffstats
path: root/build/create-artifacts.ps1
blob: aa696b05fc00bf5a110b321d88c560ad7b7defc6 (plain)
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
param (
	[Parameter(Mandatory=$true)]
	[string]
	$Root,
	
	[Parameter(Mandatory=$true)]
	[string]
	$Version,
	
	[Parameter()]
	[string]
	$Password
)

Add-Type -Assembly "system.io.compression.filesystem"
$Temp = "$Root\build\temp\"
$Out = "$Root\build\artifacts\"
if (Test-Path $Temp) 
{
    Remove-Item $Temp -Recurse
}
New-Item $Temp -Type Directory

if (Test-Path $Out) 
{
    Remove-Item $Out -Recurse
}
New-Item $Out -Type Directory

function PlatformRelease
{
	param($ReleaseType, $Platform)

	Remove-Item $Temp\* -recurse
	$PlatformShort = $Platform -Replace "win-", ""
	$Postfix = "trimmed"
	if ($ReleaseType -eq "ReleasePluggable") {
		$Postfix = "pluggable"
	}
	$MainZip = "win-acme.v$Version.$PlatformShort.$Postfix.zip"
	$MainZipPath = "$Out\$MainZip"
	$MainBin = "$Root\src\main\bin\$ReleaseType\netcoreapp3.1\$Platform"
	if (!(Test-Path $MainBin)) 
	{
		$MainBin = "$Root\src\main\bin\Any CPU\$ReleaseType\netcoreapp3.1\$Platform"
	}
	if (Test-Path $MainBin) 
	{
		./sign-exe.ps1 "$MainBin\publish\wacs.exe" "$Root\build\codesigning.pfx" $Password
		Copy-Item "$MainBin\publish\wacs.exe" $Temp
		Copy-Item "$MainBin\settings.json" "$Temp\settings_default.json"
		Copy-Item "$Root\dist\*" $Temp -Recurse
		Set-Content -Path "$Temp\version.txt" -Value "v$Version ($PlatformShort, $ReleaseType)"
		[io.compression.zipfile]::CreateFromDirectory($Temp, $MainZipPath)
	}
}

function PluginRelease
{
	param($Short, $Dir, $Files)

	Remove-Item $Temp\* -recurse
	$PlugZip = "$Dir.v$Version.zip"
	$PlugZipPath = "$Out\$PlugZip"
	$PlugBin = "$Root\src\$Dir\bin\Release\netcoreapp3.1\publish"
	if (!(Test-Path $PlugBin)) 
	{
		$PlugBin = "$Root\src\$Dir\bin\Any CPU\Release\netcoreapp3.1\publish"
	}
	if (Test-Path $PlugBin) 
	{
		foreach ($file in $files) {
			Copy-Item "$PlugBin\$file" $Temp
		}
		[io.compression.zipfile]::CreateFromDirectory($Temp, $PlugZipPath)
	}
}

PlatformRelease "Release" win-x64
PlatformRelease "Release" win-x86
PlatformRelease "ReleasePluggable" win-x64
PlatformRelease "ReleasePluggable" win-x86
PluginRelease dreamhost plugin.validation.dns.dreamhost @(
	"PKISharp.WACS.Plugins.ValidationPlugins.Dreamhost.dll"
)
PluginRelease azure plugin.validation.dns.azure @(
	"Microsoft.Azure.Management.Dns.dll", 
	"Microsoft.Azure.Services.AppAuthentication.dll",
	"Microsoft.IdentityModel.Clients.ActiveDirectory.dll",
	"Microsoft.IdentityModel.Logging.dll",
	"Microsoft.IdentityModel.Tokens.dll",
	"Microsoft.Rest.ClientRuntime.Azure.Authentication.dll",
	"Microsoft.Rest.ClientRuntime.Azure.dll",
	"Microsoft.Rest.ClientRuntime.dll",
	"PKISharp.WACS.Plugins.ValidationPlugins.Azure.dll"
)
PluginRelease route53 plugin.validation.dns.route53 @(
	"AWSSDK.Core.dll", 
	"AWSSDK.Route53.dll",
	"PKISharp.WACS.Plugins.ValidationPlugins.Route53.dll"
)
PluginRelease luadns plugin.validation.dns.luadns @(
	"PKISharp.WACS.Plugins.ValidationPlugins.LuaDns.dll"
)
PluginRelease cloudflare plugin.validation.dns.cloudflare @(
	"FluentCloudflare.dll", 
	"PKISharp.WACS.Plugins.ValidationPlugins.Cloudflare.dll"
)
PluginRelease cloudflare plugin.validation.dns.digitalocean @(
	"DigitalOcean.API.dll", 
	"RestSharp.dll", 
	"PKISharp.WACS.Plugins.ValidationPlugins.DigitalOcean.dll"
)

"Created artifacts:"
dir $Out