Chore: Upgrade Jenkins-job-builder to 6.3.0
[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 # shellcheck disable=SC1090
19 . ~/lf-env.sh
20
21 lf-activate-venv --python python3 lftools
22
23 MC_TMP_FILE="$(mktemp)"
24 echo "Staging in OSSRH for Maven Central"
25 lftools deploy nexus-stage "https://oss.sonatype.org" "$profile_id" "$WORKSPACE/m2repo" | tee "$MC_TMP_FILE"
26 mc_staging_repo=$(sed -n -e 's/Staging repository \(.*\) created\./\1/p' "$MC_TMP_FILE")
27 rm -f "$MC_TMP_FILE"
28
29 # shellcheck disable=SC2140
30 echo "$mc_staging_repo "\
31 "https://oss.sonatype.org/content/repositories/$mc_staging_repo" | \
32     tee -a "$WORKSPACE/archives/staging-repo.txt"