This repository was archived by the owner on Apr 1, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-release.sh
More file actions
executable file
·75 lines (65 loc) · 2 KB
/
build-release.sh
File metadata and controls
executable file
·75 lines (65 loc) · 2 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Build script that temporarily sets a release version, builds all artifacts, then sets to next version
#
# Usage:
# ./build-release.sh <release-version> <next-version>
#
# Examples:
# # Build 1.0.0 release, then go back to snapshot
# ./build-release.sh 1.0.0 1.0.0-SNAPSHOT
#
# # Build 1.0.0 release, then move to next minor snapshot
# ./build-release.sh 1.0.0 1.1.0-SNAPSHOT
#
# # Build 1.0.0 release, then move to next major snapshot
# ./build-release.sh 1.0.0 2.0.0-SNAPSHOT
#
# # Build release candidate, then go back to snapshot
# ./build-release.sh 2.0.0-rc1 2.0.0-SNAPSHOT
#
# This script will:
# 1. Set all module versions to <release-version>
# 2. Run mvn clean install to build all artifacts
# 3. Set all module versions to <next-version>
set -e
# Check arguments
if [ "$#" -ne 2 ]; then
echo "❌ Error: Missing arguments"
echo ""
echo "Usage: $0 <release-version> <next-version>"
echo ""
echo "Examples:"
echo " # Build 1.0.0 and revert to snapshot"
echo " $0 1.0.0 1.0.0-SNAPSHOT"
echo ""
echo " # Build 1.0.0 and move to next minor"
echo " $0 1.0.0 1.1.0-SNAPSHOT"
echo ""
echo " # Build 1.0.0 and move to next major"
echo " $0 1.0.0 2.0.0-SNAPSHOT"
exit 1
fi
RELEASE_VERSION=$1
NEXT_VERSION=$2
echo "📋 Configuration:"
echo " Release version: $RELEASE_VERSION"
echo " Next version: $NEXT_VERSION"
echo ""
echo "🔄 Setting versions to $RELEASE_VERSION..."
# Update all modules
mvn versions:set -DnewVersion=$RELEASE_VERSION -DprocessAllModules
mvn versions:commit
echo "✅ All versions set to $RELEASE_VERSION"
echo ""
echo "🏗️ Building all modules..."
# Build everything
mvn clean install
echo ""
echo "✅ Build complete! Artifacts created with version $RELEASE_VERSION"
echo ""
echo "🔄 Setting versions to $NEXT_VERSION..."
# Update to next version
mvn versions:set -DnewVersion=$NEXT_VERSION -DprocessAllModules
mvn versions:commit
echo "✅ Versions updated to $NEXT_VERSION"
echo "🎉 Done!"