-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathpost_release.ps1
59 lines (50 loc) · 1.99 KB
/
post_release.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
Param(
[string]$rel="prod",
[string]$app="dderl"
)
Write-Host "===> -------------------------------------------------------------------------"
Write-Host "===> post_release $rel/$app @ $pwd" -foregroundcolor green
$root = (Resolve-Path "_build/$rel/rel/$app/").Path
cd $root
$erts = Get-ChildItem -Filter erts-* |
Select-Object -First 1 -Expand FullName
$ertsIni = "$erts\bin\erl.ini"
If (Test-Path $ertsIni) {
Remove-Item $ertsIni
Write-Host "===> deleted $ertsIni" -foregroundcolor magenta
}
Else {
Write-Host "===> not found $ertsIni" -foregroundcolor red
}
$dderlPriv = (Resolve-Path "$root\lib\dderl-*\priv").Path
Write-Host "===> building dderl @ $dderlPriv ..." -foregroundcolor gray
If (Test-Path "$dderlPriv\dev\node_modules") {
throw "$dderlPriv\dev\node_modules already exists"
}
If (Test-Path "$dderlPriv\public\dist") {
throw "$dderlPriv\public\dist already exists"
}
cd $dderlPriv\dev
Write-Host "===> yarn install-build-prod @ $pwd" -foregroundcolor green
yarn install-build-prod
function Remove-Recursive-Force([string]$Root, [string]$Dir) {
Try {
Remove-Item "$Root\$Dir" -Force -Recurse -ea Stop
Write-Host "===> $Root\$Dir deleted" -foregroundcolor green
}
Catch {
Write-Host "===> failed to delete $Root\$Dir" -foregroundcolor red
md -Force C:\Temp
Write-Host "===> C:\Temp\ created (if didn't exist)" -foregroundcolor green
Remove-Item "C:\Temp\$Dir" -Force -Recurse -ErrorAction SilentlyContinue
Write-Host "===> any existing C:\Temp\$Dir deleted" -foregroundcolor green
Move-Item -Path "$Root\$Dir" -Force -Destination C:\Temp
Write-Host "===> $Root\$Dir moved to C:\Temp\$Dir" -foregroundcolor green
Remove-Item "C:\Temp\$Dir" -Force -Recurse
Write-Host "===> C:\Temp\$Dir deleted" -foregroundcolor green
}
}
# Cleanup
cd $dderlPriv
Remove-Recursive-Force $dderlPriv "dev"
Write-Host "===> ------------------------------------------------------------ post_release"