-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathzanata-nexus-staging
executable file
·77 lines (68 loc) · 2.16 KB
/
zanata-nexus-staging
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
76
77
#!/bin/bash
### NAME
### zanata-nexus-staging - Deploy maven artifacts to nexus-staging
###
### SYNOPSIS
### zanata-nexus-staging [options] [Projects]
###
### DESCRIPTION
### This script uses nexus-staging-maven-plugin to deploy to nexus staging.
###
### Note that this script assume you are already in correct directory and
### checkout correct branch.
###
### ARGUMENTS
### Projects
### Comma-delimited list of specified reactor projects, it will be passed as
### parameter of mvn -pl
###
### ENVIRONMENT
### ZANATA_RELEASE_MODE:
### <empty> : Default mode. Builds, deploy to staging, and push changes
### to source control
### testBuild: Builds, deploy to staging, but does not push changes to
### source control
### dryRun : Only show command to be run.
: ${ZANATA_RELEASE_MODE:=}
export LC_ALL=C
set -eu
ScriptDir=$(dirname $(readlink -q -f $0))
FunctionScriptFile=$ScriptDir/zanata-functions
source "$FunctionScriptFile"
trap exit_print_error EXIT
RepoName=$(repo_name_get)
ArtifactId=$(get_artifact_id $RepoName)
Version=$(maven_project_version)
MavenReleaseProfiles=$(get_artifact_var_value $ArtifactId MAVEN_RELEASE_PROFILES)
## List all artifacts to be released in sonatype nexus
## e.g. !server/zanata-test-war,!server/functional-test
NexusReleaseProjects=$(get_artifact_var_value $ArtifactId MAVEN_NEXUS_RELEASE_PROJECTS)
## default variables
Projects=$NexusReleaseProjects
###
### 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))
[[ -n ${1:-} ]] && Projects="$1"
if [[ -n $Projects && $Projects != 'null' ]]; then
ProjectOpts="-pl $Projects"
else
ProjectOpts=""
fi
if [[ -n $MavenReleaseProfiles ]]; then
ReleaseProfileOpts=-P$MavenReleaseProfiles
else
ReleaseProfileOpts=
fi
run_command $MvnCmd ${MAVEN_COMMON_OPTIONS:-} ${MAVEN_RELEASE_OPTIONS:-} $ReleaseProfileOpts $ProjectOpts deploy -DstagingDescription="$ArtifactId:$Version"