forked from abpframework/abp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish-ng.ps1
62 lines (53 loc) · 1.59 KB
/
publish-ng.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
param(
[string]$Version,
[string]$Registry,
[string]$LeptonXVersion
)
yarn install
$NextVersion = $(node publish-utils.js --nextVersion)
$RootFolder = (Get-Item -Path "./" -Verbose).FullName
if (-Not $Version) {
$Version = $NextVersion;
}
if (-Not $Registry) {
$Registry = "https://registry.npmjs.org";
}
$UpdateNgPacksCommand = "yarn update-version $Version"
$NgPacksPublishCommand = "npm run publish-packages -- --nextVersion $Version --skipGit --registry $Registry --skipVersionValidation"
$UpdateGulpCommand = "yarn update-gulp --registry $Registry"
$UpdateLeptonXCommand = "yarn update-lepton-x-versions -v $LeptonXVersion";
$IsPrerelease = $(node publish-utils.js --prerelease --customVersion $Version) -eq "true";
if ($IsPrerelease) {
$UpdateGulpCommand += " --prerelease"
$UpdateNgPacksCommand += " --prerelease"
}
$commands = (
"cd ng-packs",
"yarn install",
$UpdateNgPacksCommand,
"cd scripts",
"yarn install",
$NgPacksPublishCommand,
"cd ../../",
"cd scripts",
"yarn remove-lock-files",
"cd ..",
$UpdateGulpCommand,
"cd scripts",
$UpdateLeptonXCommand
)
foreach ($command in $commands) {
$timer = [System.Diagnostics.Stopwatch]::StartNew()
Write-Host $command
Invoke-Expression $command
if ($LASTEXITCODE -ne '0' -And $command -notlike '*cd *') {
Write-Host ("Process failed! " + $command)
Set-Location $RootFolder
exit $LASTEXITCODE
}
$timer.Stop()
$total = $timer.Elapsed
Write-Output "-------------------------"
Write-Output "$command command took $total (Hours:Minutes:Seconds.Milliseconds)"
Write-Output "-------------------------"
}