-
Notifications
You must be signed in to change notification settings - Fork 5
/
prepare-release.sh
executable file
·73 lines (63 loc) · 2.71 KB
/
prepare-release.sh
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
#!/usr/bin/env -S bash -e
SCRIPTS_DIR="$(readlink -f ${BASH_SOURCE[0]} | xargs dirname)"
PROJECT=$1
RELEASE_VERSION=$2
INHERITED_VERSION=$3
DEVELOPMENT_VERSION=$3
WORKSPACE=${WORKSPACE:-'.'}
if [ -z "$PROJECT" ]; then
echo "ERROR: Project not supplied"
exit 1
fi
if [ -z "$RELEASE_VERSION" ]; then
echo "ERROR: Release version argument not supplied"
exit 1
else
echo "Setting version to '$RELEASE_VERSION'";
fi
if [ "$PROJECT" == "orm" ]; then
if [ -z "$DEVELOPMENT_VERSION" ]; then
echo "ERROR: Development version argument not supplied"
exit 1
else
echo "Setting development version to '$DEVELOPMENT_VERSION'";
fi
fi
if [ -z "$BRANCH" ]; then
BRANCH="$(git branch --show-current)"
echo "Inferred release branch: $BRANCH"
fi
echo "Preparing the release ..."
pushd $WORKSPACE
# Set up git so that we can create commits
git config --local user.name "Hibernate CI"
git config --local user.email "[email protected]"
if [ "$PROJECT" == "orm" ] || [ "$PROJECT" == "reactive" ]; then
RELEASE_VERSION_BASIS=$(echo "$RELEASE_VERSION" | sed -E 's/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
RELEASE_VERSION_FAMILY=$(echo "$RELEASE_VERSION" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
"$SCRIPTS_DIR/validate-release.sh" $PROJECT $RELEASE_VERSION
# set release version
# update changelog from JIRA
# tags the version
# changes the version to the provided development version
./gradlew clean releasePrepare -x test --no-scan --no-daemon --no-build-cache \
-PreleaseVersion=$RELEASE_VERSION -PdevelopmentVersion=$DEVELOPMENT_VERSION -PgitRemote=origin -PgitBranch=$BRANCH -PdocPublishBranch="production" \
-PSONATYPE_OSSRH_USER=$OSSRH_USER -PSONATYPE_OSSRH_PASSWORD=$OSSRH_PASSWORD \
-Pgradle.publish.key=$PLUGIN_PORTAL_USERNAME -Pgradle.publish.secret=$PLUGIN_PORTAL_PASSWORD \
-PhibernatePublishUsername=$OSSRH_USER -PhibernatePublishPassword=$OSSRH_PASSWORD \
-DsigningPassword=$RELEASE_GPG_PASSPHRASE -DsigningKeyFile=$RELEASE_GPG_PRIVATE_KEY_PATH
else
if [[ "$PROJECT" != "hcann" && ! $PROJECT =~ ^infra-.+ ]]; then
# These projects do not have a distribution bundle archive,
# hence we do not want to check the sourceforge availability as we will not be uploading anything.
# There is also no version in the readme and no changelog file.
"$SCRIPTS_DIR/check-sourceforge-availability.sh"
"$SCRIPTS_DIR/update-readme.sh" $PROJECT $RELEASE_VERSION "$WORKSPACE/README.md"
"$SCRIPTS_DIR/update-changelog.sh" $PROJECT $RELEASE_VERSION "$WORKSPACE/changelog.txt"
fi
"$SCRIPTS_DIR/validate-release.sh" $PROJECT $RELEASE_VERSION
"$SCRIPTS_DIR/update-version.sh" $PROJECT $RELEASE_VERSION $INHERITED_VERSION
"$SCRIPTS_DIR/create-tag.sh" $PROJECT $RELEASE_VERSION
fi
popd
echo "Release ready: version is updated to $RELEASE_VERSION"