refactor(syndesis): rearranged release command
@@ -71,13 +71,19 @@ release::run() {
fi
echo "Creating new staging repository..."
- local repo_id=$(open_staging_repository "$maven_opts")
+ local repo_id=$(open_staging_repository "$maven_opts" $release_version)
echo "Opened staging repository: $repo_id"
#There is no tag yet, so let's pass $NO_TAG instead.
trap "do_cleanup \"$repo_id\" \"$NO_TAG\" \"$maven_opts\"" EXIT
- do_release "$release_snapshots" "$release_version" "$dev_version" "$maven_opts"
+ local maven_args=""
+ if [ -n "${release_snapshots}" ]; then
+ maven_args="clean package deploy:deploy -DstagingRepositoryId=$repo_id $maven_opts"
+ else
+ maven_args="-B release:clean release:prepare release:perform -DstagingRepositoryId=$repo_id -DpushChanges=false -DreleaseVersion=${release_version} -DdevelopmentVersion=${dev_version} -Dtag=$release_version $maven_opts"
+ fi
+ call_maven "$maven_args"
if [ -z "${release_snapshots}" ]; then
# Update the trap with the tag created.
@@ -109,7 +115,7 @@ release::run() {
open_staging_repository() {
local maven_opts=$1
- local maven_args="org.sonatype.plugins:nexus-staging-maven-plugin:${NEXUS_STAGING_PLUGIN_VERSION}:rc-open -DnexusUrl=${NEXUS_URL} -DserverId=${NEXUS_SERVER_ID} -DstagingProfileId=${NEXUS_DEFAULT_STAGING_PROFILE_ID} -DopenedRepositoryMessageFormat='$REPO_ANNOUNCEMENT_PREFIX:%s' $maven_opts"
+ local maven_args="org.sonatype.plugins:nexus-staging-maven-plugin:${NEXUS_STAGING_PLUGIN_VERSION}:rc-open -DnexusUrl=${NEXUS_URL} -DstagingDescriptions='Version $release_version' -DserverId=${NEXUS_SERVER_ID} -DstagingProfileId=${NEXUS_DEFAULT_STAGING_PROFILE_ID} -DopenedRepositoryMessageFormat='$REPO_ANNOUNCEMENT_PREFIX:%s' $maven_opts"
#Call maven and just grab the last line that contains $REPO_ANNOUNCEMENT_PREFIX discard the line that displays the whole command and get the string that is between `:` and `'`.
call_maven "$maven_args" | tee /tmp/x.log | grep -v maven | grep $REPO_ANNOUNCEMENT_PREFIX | tail -n 1 | awk -F ":" '{print $2}' | awk -F "'" '{print $1}'
}
@@ -131,23 +137,6 @@ call_sonatype() {
local repo_id=$2
local maven_opts=$3
local maven_args="org.sonatype.plugins:nexus-staging-maven-plugin:${NEXUS_STAGING_PLUGIN_VERSION}:${command} -DnexusUrl=${NEXUS_URL} -DserverId=${NEXUS_SERVER_ID} -DstagingRepositoryId=$repo_id $maven_opts"
- call_maven "$maven_args" > /dev/null
-}
-
-do_release() {
- local release_snapshots=$1
- local release_version=$2
- local dev_version=$3
- local maven_opts=$4
-
- local maven_args=""
-
- if [ -n "${release_snapshots}" ]; then
- maven_args="clean package deploy:deploy $maven_opts"
- else
- maven_args="-B release:clean release:prepare release:perform -DpushChanges=false -DreleaseVersion=${release_version} -DdevelopmentVersion=${dev_version} -Dtag=$release_version $maven_opts"
- fi
-
call_maven "$maven_args"
}
