Skip to content

Commit bb2348d

Browse files
committed
Imps: 1. improve release scripts
1 parent 9b58554 commit bb2348d

File tree

5 files changed

+38
-27
lines changed

5 files changed

+38
-27
lines changed

bin/pulsar.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
$ErrorActionPreference = "Stop"
22

3-
$BIN = Split-Path -Parent $MyInvocation.MyCommand.Definition
4-
$APP_HOME = (Resolve-Path "$BIN/..").Path
3+
# Find the first parent directory containing the VERSION file
4+
$AppHome=(Get-Item -Path $MyInvocation.MyCommand.Path).Directory
5+
while ($AppHome -ne $null -and !(Test-Path "$AppHome/VERSION")) {
6+
$AppHome=$AppHome.Parent
7+
}
8+
cd $AppHome
59

610
$UBERJAR = Join-Path $PWD "target\PulsarRPA.jar"
711
if (-not (Test-Path $UBERJAR)) {
8-
$SERVER_HOME = Join-Path $APP_HOME "pulsar-app\pulsar-master"
12+
$SERVER_HOME = Join-Path $AppHome "pulsar-app\pulsar-master"
913
Copy-Item (Join-Path $SERVER_HOME "target\PulsarRPA.jar") -Destination $UBERJAR
1014
}
1115

bin/release/next-minor.ps1

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# Set up variables
2-
$bin = Split-Path -Parent $MyInvocation.MyCommand.Definition
3-
$bin = (Resolve-Path "$bin\..").Path
4-
$APP_HOME = (Resolve-Path "$bin\..").Path
1+
# Find the first parent directory containing the VERSION file
2+
$AppHome=(Get-Item -Path $MyInvocation.MyCommand.Path).Directory
3+
while ($AppHome -ne $null -and !(Test-Path "$AppHome/VERSION")) {
4+
$AppHome=$AppHome.Parent
5+
}
6+
cd $AppHome
57

68
# Get version information
7-
$SNAPSHOT_VERSION = Get-Content "$APP_HOME\VERSION" -TotalCount 1
9+
$SNAPSHOT_VERSION = Get-Content "$AppHome\VERSION" -TotalCount 1
810
$VERSION = $SNAPSHOT_VERSION -replace "-SNAPSHOT", ""
911
$parts = $VERSION -split "\."
1012
$PREFIX = $parts[0] + "." + $parts[1]
@@ -18,21 +20,21 @@ $NEXT_SNAPSHOT_VERSION = "$NEXT_VERSION-SNAPSHOT"
1820
Write-Host "New version: $NEXT_SNAPSHOT_VERSION"
1921

2022
# Update VERSION file
21-
$NEXT_SNAPSHOT_VERSION | Set-Content "$APP_HOME\VERSION"
23+
$NEXT_SNAPSHOT_VERSION | Set-Content "$AppHome\VERSION"
2224

23-
# Update $APP_HOME/pom.xml
24-
$pomXmlPath = "$APP_HOME\pom.xml"
25+
# Update $AppHome/pom.xml
26+
$pomXmlPath = "$AppHome\pom.xml"
2527
((Get-Content $pomXmlPath) -replace "<tag>v$VERSION</tag>", "<tag>v$NEXT_VERSION</tag>") | Set-Content $pomXmlPath
2628

2729
# Update pom.xml files
28-
Get-ChildItem "$APP_HOME" -Depth 3 -Filter 'pom.xml' -Recurse | ForEach-Object {
30+
Get-ChildItem "$AppHome" -Depth 3 -Filter 'pom.xml' -Recurse | ForEach-Object {
2931
((Get-Content $_.FullName) -replace $SNAPSHOT_VERSION, $NEXT_SNAPSHOT_VERSION) | Set-Content $_.FullName
3032
}
3133

3234
# Files containing the version number to upgrade
3335
$VERSION_AWARE_FILES = @(
34-
"$APP_HOME\README.md"
35-
"$APP_HOME\README-CN.md"
36+
"$AppHome\README.md"
37+
"$AppHome\README-CN.md"
3638
)
3739

3840
# Replace version numbers in files

bin/release/next-minor.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ find "$APP_HOME" -name 'pom.xml' -exec sed -i "s/$SNAPSHOT_VERSION/$NEXT_SNAPSHO
2828

2929
# The following files contains the version number to upgrade
3030
VERSION_AWARE_FILES=(
31+
"$APP_HOME/README.adoc"
3132
"$APP_HOME/README.md"
32-
"$APP_HOME/README.md"
33-
"$APP_HOME/README.md"
34-
"$APP_HOME/README.md"
33+
"$APP_HOME/README-CN.adoc"
34+
"$APP_HOME/README-CN.md"
3535
)
3636
# replace version numbers to be the next numbers in files
3737
for F in "${VERSION_AWARE_FILES[@]}"; do

bin/release/release.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
# Set up variables
2-
$bin = Split-Path -Parent $MyInvocation.MyCommand.Definition
3-
$APP_HOME = (Resolve-Path "$bin\..").Path
1+
# Find the first parent directory containing the VERSION file
2+
$AppHome=(Get-Item -Path $MyInvocation.MyCommand.Path).Directory
3+
while ($AppHome -ne $null -and !(Test-Path "$AppHome/VERSION")) {
4+
$AppHome=$AppHome.Parent
5+
}
6+
cd $AppHome
7+
48
$gitExe = "git" # Assuming git is in the system PATH
59

610
# Switching remote URLs from HTTPS to SSH
711
& $gitExe remote set-url origin git@github.com:platonai/PulsarRPA.git
812

913
# Get version information
10-
$SNAPSHOT_VERSION = Get-Content "$APP_HOME\VERSION" -TotalCount 1
14+
$SNAPSHOT_VERSION = Get-Content "$AppHome\VERSION" -TotalCount 1
1115
$VERSION =$SNAPSHOT_VERSION -replace "-SNAPSHOT", ""
1216
$LAST_COMMIT_ID = &$gitExe log --format="%H" -n 1
1317
$BRANCH = &$gitExe branch --show-current

bin/version.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
#!/usr/bin/env ps1
2-
3-
$bin = Split-Path $MyInvocation.MyCommand.Path
4-
Push-Location $bin -ErrorAction SilentlyContinue; Pop-Location
5-
$APP_HOME = Split-Path $bin
1+
# Find the first parent directory containing the VERSION file
2+
$AppHome=(Get-Item -Path $MyInvocation.MyCommand.Path).Directory
3+
while ($AppHome -ne $null -and !(Test-Path "$AppHome/VERSION")) {
4+
$AppHome=$AppHome.Parent
5+
}
6+
cd $AppHome
67

7-
$VERSION = "v$(Get-Content "$APP_HOME/VERSION")"
8+
$VERSION = "v$(Get-Content "$AppHome/VERSION")"
89

910
if ($args.Count -gt 0 -and $args[0] -eq "-v") {
1011
# dynamically pull more interesting stuff from latest git commit

0 commit comments

Comments
 (0)