Skip to content

Commit

Permalink
Script to quickly update the version number
Browse files Browse the repository at this point in the history
  • Loading branch information
pbswengineering committed Nov 26, 2020
1 parent 315ef40 commit 040adec
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions Update-Version.ps1
@@ -0,0 +1,25 @@
# Update the version number in pom,xml, Const.java and Create-Package.ps1
if ($args.Length -lt 2) {
Write-Output "Update PDF Juggler version in pom.xml, Const.java and Create-Package.ps1`n"
Write-Output "Usage: Update-Version.ps1 <old_version> <new_version>`n"
Write-Output " old_version: the old version (usually in x.y format)"
Write-Output " new_version: the new version (usually in x.y format)`n"
exit
}
$oldVersion = $args[0]
$newVersion = $args[1]
Function Update-File ($file, $original, $replacement)
{
Write-Output "Updating $file from ${oldVersion} to ${newVersion}"
(Get-Content $file).replace($original, $replacement) | Set-Content $file
}

Update-File pom.xml `
"<version>$oldVersion</version><!-- Main version -->" `
"<version>$newVersion</version><!-- Main version -->"
Update-File src/main/java/cloud/bernardi/pdfjuggler/Const.java `
"public static final String VERSION = `"$oldVersion`";" `
"public static final String VERSION = `"$newVersion`";"
Update-File Create-Package.ps1 `
"`$Version = `"$oldVersion`"" `
"`$Version = `"$newVersion`""
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cloud.bernardi</groupId>
<artifactId>pdfjuggler</artifactId>
<version>1.0</version>
<version>1.0</version><!-- Main version -->
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -72,4 +72,4 @@
</plugins>
</build>
<name>pdfjuggler</name>
</project>
</project>

0 comments on commit 040adec

Please sign in to comment.