Skip to content

Commit a183511

Browse files
committed
Add models to the script
Signed-off-by: marko-bekhta <[email protected]>
1 parent ac71b69 commit a183511

7 files changed

+47
-37
lines changed

deploy.sh

+2-24
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
#!/usr/bin/env -S bash -e
22

3-
while getopts 'd:' opt; do
4-
case "$opt" in
5-
d)
6-
# Dry run
7-
echo "DRY RUN: will not push/deploy/publish anything."
8-
export JRELEASER_DRY_RUN=true
9-
;;
10-
\?)
11-
usage
12-
exit 1
13-
;;
14-
esac
15-
done
16-
173
SCRIPTS_DIR="$(readlink -f ${BASH_SOURCE[0]} | xargs dirname)"
184

195
PROJECT=$1
@@ -62,17 +48,9 @@ else
6248

6349
if [ -f "./jreleaser.yml" ]; then
6450
# JReleaser-based build
65-
export JRELEASER_GPG_HOMEDIR="$RELEASE_GPG_HOMEDIR"
66-
# Get the jreleaser downloader
67-
curl -sL https://git.io/get-jreleaser > get_jreleaser.java
68-
# Download JReleaser with version = <version>
69-
# Change <version> to a tagged JReleaser release
70-
# or leave it out to pull `latest`.
71-
java get_jreleaser.java
72-
# Let's check we've got the right version
73-
java -jar jreleaser-cli.jar --version
51+
source "$SCRIPTS_DIR/jreleaser-setup.sh"
7452
# Execute a JReleaser command such as 'full-release'
75-
java -jar jreleaser-cli.jar full-release -Djreleaser.project.version="$RELEASE_VERSION"
53+
./jreleaser/bin/jreleaser full-release -Djreleaser.project.version="$RELEASE_VERSION"
7654
fi
7755
fi
7856

determine-current-version.sh

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ if [ "$PROJECT" == "orm" ]; then
1515
elif [ "$PROJECT" == "reactive" ]; then
1616
# For example, if `version.properties` contains `projectVersion=2.4.5-SNAPSHOT`, it returns `2.4.5-SNAPSHOT`
1717
grep projectVersion $WORKSPACE/gradle/version.properties|cut -d'=' -f2
18+
elif [ "$PROJECT" == "models" ]; then
19+
cat $WORKSPACE/version.txt
1820
elif [ -f './gradlew' ]; then
1921
# Gradle-based build
2022
grep hibernateVersion $WORKSPACE/gradle/version.properties|cut -d'=' -f2

jreleaser-setup.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env -S bash -e
2+
# To be sourced from other scripts. Tip: use the following lines to source it independently from the PWD,
3+
# provided your script is in the same directory as this one:
4+
# SCRIPTS_DIR="$(readlink -f ${BASH_SOURCE[0]} | xargs dirname)"
5+
# source "$SCRIPTS_DIR/jreleaser-setup.sh"
6+
7+
if [ -d "jreleaser" ]; then
8+
echo "JReleaser was already set up."
9+
./jreleaser/bin/jreleaser --version
10+
return
11+
fi
12+
13+
wget https://github.com/jreleaser/jreleaser/releases/download/v1.17.0/jreleaser-1.17.0.zip -qO jreleaser.zip
14+
unzip jreleaser.zip
15+
mv jreleaser-1.17.0 jreleaser
16+
rm jreleaser.zip
17+
18+
./jreleaser/bin/jreleaser --version

prepare-release.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,18 @@ pushd $WORKSPACE
4040
git config --local user.name "Hibernate CI"
4141
git config --local user.email "[email protected]"
4242

43-
if [ "$PROJECT" == "orm" ] || [ "$PROJECT" == "reactive" ]; then
43+
if [ "$PROJECT" == "orm" ] || [ "$PROJECT" == "reactive" ] || [ "$PROJECT" == "models" ]; then
4444
RELEASE_VERSION_BASIS=$(echo "$RELEASE_VERSION" | sed -E 's/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
4545
RELEASE_VERSION_FAMILY=$(echo "$RELEASE_VERSION" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
4646
"$SCRIPTS_DIR/validate-release.sh" $PROJECT $RELEASE_VERSION
4747
# set release version
4848
# update changelog from JIRA
4949
# tags the version
5050
# changes the version to the provided development version
51-
./gradlew clean releasePrepare -x test --no-scan --no-daemon --no-build-cache \
51+
./gradlew clean releasePrepare pTML -x test --no-scan --no-daemon --no-build-cache \
5252
-PreleaseVersion=$RELEASE_VERSION -PdevelopmentVersion=$DEVELOPMENT_VERSION \
53-
-PgitRemote=origin -PgitBranch=$BRANCH
53+
-PgitRemote=origin -PgitBranch=$BRANCH \
54+
-Dmaven.repo.local=$(pwd)/build/staging-deploy/maven
5455
else
5556
if [[ "$PROJECT" != "tools" && "$PROJECT" != "hcann" && ! $PROJECT =~ ^infra-.+ ]]; then
5657
# These projects do not have a distribution bundle archive,

publish.sh

+15-9
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,10 @@ if [ -z "$DEVELOPMENT_VERSION" ]; then
7373
echo "ERROR: Development version not supplied"
7474
exit 1
7575
fi
76-
if [ "$PUSH_CHANGES" != "true" ]; then
77-
ADDITIONAL_OPTIONS="-d"
78-
fi
7976

8077
RELEASE_VERSION_FAMILY=$(echo "$RELEASE_VERSION" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
8178

82-
if [ "$PROJECT" == "orm" ] || [ "$PROJECT" == "reactive" ]; then
79+
if [ "$PROJECT" == "orm" ] || [ "$PROJECT" == "reactive" ] || [ "$PROJECT" == "models" ]; then
8380
git config user.email [email protected]
8481
git config user.name Hibernate-CI
8582

@@ -88,12 +85,21 @@ if [ "$PROJECT" == "orm" ] || [ "$PROJECT" == "reactive" ]; then
8885
EXTRA_ARGS=" --dry-run"
8986
fi
9087

91-
./gradlew releasePerform closeAndReleaseSonatypeStagingRepository -x test \
92-
--no-scan --no-daemon --no-build-cache --stacktrace $EXTRA_ARGS \
93-
-PreleaseVersion=$RELEASE_VERSION -PdevelopmentVersion=$DEVELOPMENT_VERSION \
94-
-PdocPublishBranch=production -PgitRemote=origin -PgitBranch=$BRANCH
88+
if [ -f "./jreleaser.yml" ]; then
89+
# JReleaser-based build
90+
source "$SCRIPTS_DIR/jreleaser-setup.sh"
91+
# Execute a JReleaser command such as 'full-release'
92+
./jreleaser/bin/jreleaser full-release -Djreleaser.project.version="$RELEASE_VERSION"
93+
else
94+
EXTRA_ARGS+=" closeAndReleaseSonatypeStagingRepository"
95+
fi
96+
97+
./gradlew releasePerform -x test \
98+
--no-scan --no-daemon --no-build-cache --stacktrace $EXTRA_ARGS \
99+
-PreleaseVersion=$RELEASE_VERSION -PdevelopmentVersion=$DEVELOPMENT_VERSION \
100+
-PdocPublishBranch=production -PgitRemote=origin -PgitBranch=$BRANCH
95101
else
96-
bash -xe "$SCRIPTS_DIR/deploy.sh" $ADDITIONAL_OPTIONS "$PROJECT"
102+
bash -xe "$SCRIPTS_DIR/deploy.sh" "$PROJECT"
97103
if [[ "$PROJECT" != "tools" && "$PROJECT" != "hcann" && ! $PROJECT =~ ^infra-.+ ]]; then
98104
exec_or_dry_run bash -xe "$SCRIPTS_DIR/upload-distribution.sh" "$PROJECT" "$RELEASE_VERSION"
99105
exec_or_dry_run bash -xe "$SCRIPTS_DIR/upload-documentation.sh" "$PROJECT" "$RELEASE_VERSION" "$RELEASE_VERSION_FAMILY"

release.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ while getopts 'dhb:' opt; do
4040
# Dry run
4141
echo "DRY RUN: will not push/deploy/publish anything."
4242
PUSH_CHANGES=false
43+
export JRELEASER_DRY_RUN=true
4344
function exec_or_dry_run() {
4445
echo "DRY RUN; would have executed:" "${@}"
4546
}
@@ -112,6 +113,8 @@ elif [ "$PROJECT" == "reactive" ]; then
112113
JIRA_PROJECT="HREACT"
113114
elif [ "$PROJECT" == "tools" ]; then
114115
JIRA_PROJECT="HBX"
116+
elif [ "$PROJECT" == "models" ]; then
117+
echo 'No JIRA project available'
115118
elif [[ $PROJECT =~ ^infra-.+ ]]; then
116119
echo 'No JIRA project available'
117120
else
@@ -145,7 +148,6 @@ function gpg_import() {
145148
keyId=$(gpg "${@}" --batch --import "$privateKeyPath" 2>&1 | tee >(cat 1>&2) | grep 'key.*: secret key imported' | sed -E 's/.*key ([^:]+):.*/\1/')
146149
# output the fingerprint of the imported key
147150
gpg "${@}" --list-secret-keys --with-colon "$keyId" | sed -E '2!d;s/.*:([^:]+):$/\1/'
148-
export JRELEASER_GPG_KEYNAME=$keyId
149151
}
150152

151153
function gpg_delete() {
@@ -181,6 +183,7 @@ if [ -e "$RELEASE_GPG_HOMEDIR" ]; then
181183
fi
182184
mkdir -p -m 700 "$RELEASE_GPG_HOMEDIR"
183185
export GNUPGHOME="$RELEASE_GPG_HOMEDIR"
186+
export JRELEASER_GPG_HOMEDIR="$RELEASE_GPG_HOMEDIR"
184187
IMPORTED_KEY="$(gpg_import "$RELEASE_GPG_PRIVATE_KEY_PATH")"
185188
if [ -z "$IMPORTED_KEY" ]; then
186189
echo "Failed to import GPG key"

validate-release.sh

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ elif [ "$PROJECT" == "hcann" ]; then
3333
STRIPPED_SUFFIX_FOR_TAG=""
3434
elif [ "$PROJECT" == "tools" ]; then
3535
STRIPPED_SUFFIX_FOR_TAG=""
36+
elif [ "$PROJECT" == "models" ]; then
37+
STRIPPED_SUFFIX_FOR_TAG=""
3638
else
3739
echo "ERROR: Unknown project name $PROJECT"
3840
exit 1

0 commit comments

Comments
 (0)