generated from cyberark/conjur-template
-
Notifications
You must be signed in to change notification settings - Fork 8
/
publish.sh
executable file
·46 lines (37 loc) · 1.44 KB
/
publish.sh
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
#!/usr/bin/env bash
# Publish a pre-release to artifactory
set -euo pipefail
# Load docker_rt function from utils.sh
# shellcheck source=/dev/null
. "$(dirname "${0}")/utils.sh"
# shellcheck disable=SC2012
target_package="$(ls -1tr target/*.jar |tail -n 1)"
# Copy built jar to ASSET_DIR so it will be attached to the Github Release
if [[ -n "${ASSET_DIR:-}" ]] && [[ -d "${ASSET_DIR:-}" ]]; then
echo "Copying ${target_package} to Asset Dir: ${ASSET_DIR}"
cp target/*.jar "${ASSET_DIR}"
else
echo "ASSET_DIR is unset, unable to copy ${target_package} to ASSET_DIR for github release. ❌"
exit 1
fi
mkdir -p maven_cache
if [[ "${MODE:-}" == "PROMOTE" ]]; then
echo "PROMOTE build, publishing to internal artifactory and ossrh (maven central)"
maven_profiles="artifactory,ossrh,sign"
else
echo "Release build, publishing to internal artifactory"
maven_profiles="artifactory,sign"
fi
docker run \
-e OSSRH_USERNAME \
-e OSSRH_PASSWORD \
-e JFROG_USERNAME \
-e JFROG_APIKEY \
--volume "${PWD}:${PWD}" \
--volume "${PWD}/maven_cache":/root/.m2 \
--volume "$GPG_PASSWORD:/gpg_password" \
--volume "$GPG_PRIVATE_KEY:/gpg_key" \
--workdir "${PWD}" \
tools \
/bin/bash -ec "gpg --batch --passphrase-file /gpg_password --trust-model always --import /gpg_key
mvn --batch-mode --settings mvn-settings.xml --file pom.xml deploy -Dmaven.test.skip -P ${maven_profiles}"