88c3bc146364146d66fd583338d9d2acc13bc779
[releng/global-jjb.git] / shell / maven-central.sh
1 #!/bin/bash -l
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> maven-central.sh"
12
13 profile_id="${OSSRH_PROFILE_ID:-}"
14
15 # Ensure we fail the job if any steps fail.
16 set -eux -o pipefail
17
18 MC_TMP_FILE="$(mktemp)"
19 echo "Staging in OSSRH for Maven Central"
20 lftools deploy nexus-stage "https://oss.sonatype.org" "$profile_id" "$WORKSPACE/m2repo" | tee "$MC_TMP_FILE"
21 mc_staging_repo=$(sed -n -e 's/Staging repository \(.*\) created\./\1/p' "$MC_TMP_FILE")
22 rm -f "$MC_TMP_FILE"
23
24 # shellcheck disable=SC2140
25 echo "$mc_staging_repo "\
26 "https://oss.sonatype.org/content/repositories/$mc_staging_repo" | \
27     tee -a "$WORKSPACE/archives/staging-repo.txt"