From 522241ca336253f73306deac7a5dbf15cc36a608 Mon Sep 17 00:00:00 2001 From: Ding-Yi Chen Date: Thu, 1 Mar 2018 16:12:11 +1000 Subject: [PATCH] Add stagingDescription to nexus-release --- zanata-nexus | 93 -------------------------------------------- zanata-nexus-release | 3 +- zanata-nexus-staging | 2 +- 3 files changed, 3 insertions(+), 95 deletions(-) delete mode 100755 zanata-nexus diff --git a/zanata-nexus b/zanata-nexus deleted file mode 100755 index ba658e5..0000000 --- a/zanata-nexus +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/bash -### NAME -### zanata-nexus - Release maven artifacts in nexus-staging -### via nexus-staging-maven-plugin -### -### SYNOPSIS -### zanata-nexus [options] [Projects] -### -### DESCRIPTION -### This script is currently not used because -### org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy is not a drop-in -### replacement. It generate following error -### [ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy (default-cli) on project build-tools: -### The packaging for this project did not assign a file to the build artifact. -### -### This script deploy to nexus staging, close it, and release from it. -### -### Note that this script assume you are already in correct directory and -### checkout correct branch. -### -### plugin docs: -### https://github.com/sonatype/nexus-maven-plugins/tree/master/staging/maven-plugin -### -### ENVIRONMENT -### ZANATA_RELEASE_MODE: -### : Default mode. Builds, deploy to nexus staging, and push changes -### to source control -### testBuild: Builds, deploy to nexus staging, but does not push changes to -### source control, and nor does it close the nexus staging repo -### dryRun : Only show command to be run. -: ${ZANATA_RELEASE_MODE:=} -: ${DryRunMode:=0} - -export LC_ALL=C -set -eu -ScriptDir=$(dirname $(readlink -q -f $0)) -FunctionScriptFile=${ScriptDir}/zanata-functions -source "$FunctionScriptFile" -trap exit_print_error EXIT - -### -### OPTIONS -while getopts "h" opt;do - case $opt in -### -h: Show detail help - h ) - zanata_script_help $0 - exit ${EXIT_OK} - ;; - * ) - failed ${EXIT_FATAL_INVALID_OPTIONS} "$opt" - ;; - esac -done -shift $((OPTIND-1)) - -PluginFlags="-DautoReleaseAfterClose=true" -case $ZANATA_RELEASE_MODE in - dryRun ) - DryRunMode=1 - ;; - testBuild ) - DryRunMode=0 - PluginFlags="-DautoReleaseAfterClose=false -DskipStagingRepositoryClose=true" - ;; - * ) - ;; -esac -export DryRunMode - -Projects="${1-}" - - -if [[ -n $Projects && $Projects != 'null' ]]; then - ProjectOpts="-pl $Projects" -else - ProjectOpts="" -fi - -## Assumption: Staging repository state is CLOSED here -## If not we have to load nexus-staging-maven-plugin:rc-list again, -## which might take 1 or 2 minutes to complete. -print_status " nexus:deploy" - - -if [[ $ZANATA_RELEASE_MODE = testBuild ]]; then - export DryRunMode=1 -fi -run_command ./mvnw $MAVEN_NEXUS_STAGING_OPTIONS ${MAVEN_NEXUS_STAGING_PLUGIN}:deploy \ - -DprofileId=org.zanata ${ProjectOpts} - -## No need to restore DryRunMode in end of the script - diff --git a/zanata-nexus-release b/zanata-nexus-release index 64e8c70..d1b26b7 100755 --- a/zanata-nexus-release +++ b/zanata-nexus-release @@ -36,6 +36,7 @@ print_status -t parsing -s "Start" RepoName=$(repo_name_get) ArtifactId=$(get_artifact_id $RepoName) +Version=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:exec) MavenReleaseProfiles=$(get_artifact_var_value $ArtifactId maven_release_profiles) @@ -126,7 +127,7 @@ fi run_maven(){ local goal=$1 shift - run_command ./mvnw $MAVEN_COMMON_OPTIONS ${MAVEN_NEXUS_STAGING_OPTIONS:-} $ReleaseProfileOpts ${MAVEN_NEXUS_STAGING_PLUGIN}:$goal "$@" + run_command ./mvnw $MAVEN_COMMON_OPTIONS ${MAVEN_NEXUS_STAGING_OPTIONS:-} $ReleaseProfileOpts -DstagingDescription="$ArtifactId:$Version" ${MAVEN_NEXUS_STAGING_PLUGIN}:$goal "$@" } ## This function runs the staging plugin to fetch the repository id and state into these variables: diff --git a/zanata-nexus-staging b/zanata-nexus-staging index 96b2a0e..f927aed 100755 --- a/zanata-nexus-staging +++ b/zanata-nexus-staging @@ -80,4 +80,4 @@ else ReleaseProfileOpts= fi -run_command ./mvnw ${MAVEN_COMMON_OPTIONS:-} ${MAVEN_RELEASE_OPTIONS:-} $ReleaseProfileOpts $ProjectOpts $Goal -DstagingDescription="$ArtifactId-$Version" +run_command ./mvnw ${MAVEN_COMMON_OPTIONS:-} ${MAVEN_RELEASE_OPTIONS:-} $ReleaseProfileOpts $ProjectOpts $Goal -DstagingDescription="$ArtifactId:$Version"