Skip to content

Commit ae79c6c

Browse files
committed
chore: add scripts to change project version
1 parent 64819e4 commit ae79c6c

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

scripts/prepare-release.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# Navigate to the parent folder of the script
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
PARENT_DIR="$(dirname "$SCRIPT_DIR")"
6+
cd "$PARENT_DIR" || { echo "Error: Failed to navigate to parent folder."; exit 1; }
7+
8+
# Update the root directory pom and its reference on the test import
9+
mvn versions:set -DnewVersion=2.0.0 -DprocessAllModules -DgenerateBackupPoms=false
10+
11+
# Update the pom and the manifest of the plugin module
12+
mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=2.0.0 -pl com.developer.nefarious.zjoule.plugin
13+
14+
# Update the pom and the manifest of the test module
15+
mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=2.0.0 -pl com.developer.nefarious.zjoule.test
16+
17+
# Update the pom and the feature file of the feature module
18+
mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=2.0.0 -pl com.developer.nefarious.zjoule.feature
19+
20+
# Update the pom of the updatesite module
21+
mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=2.0.0 -pl com.developer.nefarious.zjoule.updatesite
22+
23+
# Update the category.xml file with the new version at the updatesite module
24+
chmod +x ./scripts/update-category.sh
25+
./scripts/update-category.sh 2.0.0

scripts/update-category.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Check if the version argument is provided
4+
if [ "$#" -ne 1 ]; then
5+
echo "Usage: $0 <new_version>"
6+
exit 1
7+
fi
8+
9+
# Assign the new version from the argument
10+
NEW_VERSION="$1"
11+
12+
# Define the path to the category.xml file
13+
CATEGORY_XML="./com.developer.nefarious.zjoule.updatesite/category.xml"
14+
15+
# Check if the category.xml file exists
16+
if [ ! -f "$CATEGORY_XML" ]; then
17+
echo "Error: $CATEGORY_XML file not found!"
18+
exit 1
19+
fi
20+
21+
# Update the url and version attributes inside the feature tag
22+
sed -i -E "s|(<feature url=\"features/com.developer.nefarious.zjoule_)[^\"]*(\\.jar\" id=\"com.developer.nefarious.zjoule\" version=\")[^\"]*\"|\\1${NEW_VERSION}\\2${NEW_VERSION}\"|" "$CATEGORY_XML"
23+
24+
# Provide feedback to the user
25+
if [ $? -eq 0 ]; then
26+
echo "Successfully updated version to ${NEW_VERSION} in $CATEGORY_XML"
27+
else
28+
echo "Failed to update $CATEGORY_XML"
29+
exit 1
30+
fi

0 commit comments

Comments
 (0)