-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.ps1
41 lines (33 loc) · 1.1 KB
/
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
if (Test-Path -Path build) {
Remove-Item -Path build -Recurse
}
.\gradlew.bat build
$projectVersion = (gradle printVersion | Select-String -Pattern '\d+\.\d+\.\d+').ToString().Trim()
$outFolder = "es-$projectVersion.prebuilt"
if (Test-Path -Path $outFolder) {
Remove-Item -Path $outFolder -Recurse
}
mkdir $outFolder
Copy-Item -Path .\build\libs\ebook-server-*-RELEASE.war -Destination $outFolder
Push-Location -Path ui
if (Test-Path -Path 'build') {
Remove-Item -Path build -Recurse
}
npm run build
Pop-Location
Copy-Item -Path .\ui\build -Destination $outFolder\ui -Recurse
if (-not (Get-Command Compress-7Zip -ErrorAction Ignore)) {
Install-Package -Scope CurrentUser 7Zip4PowerShell
}
$outTarPath = "$outFolder.tar"
if (Test-Path -Path $outTarPath) {
Remove-Item $outTarPath
}
$outTarGzipPath = "$outTarPath.gz"
if (Test-Path -Path $outTarGzipPath) {
Remove-Item $outTarGzipPath
}
Compress-7Zip -ArchiveFileName $outTarPath -Path $outFolder -Format Tar
Compress-7Zip -ArchiveFileName $outTarGzipPath -Path $outTarPath -Format GZip
Remove-Item $outTarPath
Remove-Item $outFolder -Recurse