|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2019 Google Inc. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +set -eo pipefail |
| 17 | + |
| 18 | +# Get secrets from keystore and set and environment variables |
| 19 | +setup_environment_secrets() { |
| 20 | + export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) |
| 21 | + export GPG_TTY=$(tty) |
| 22 | + export GPG_HOMEDIR=/gpg |
| 23 | + mkdir $GPG_HOMEDIR |
| 24 | + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg |
| 25 | + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg |
| 26 | + export GPG_KEY_ID=$(echo -n $(gpg --with-colons ${GPG_HOMEDIR}/pubring.gpg | awk -F':' '/pub/{ print $5 }')) |
| 27 | + export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') |
| 28 | + export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') |
| 29 | +} |
| 30 | + |
| 31 | +create_gradle_properties_file() { |
| 32 | + echo " |
| 33 | +signing.gnupg.executable=gpg |
| 34 | +signing.gnupg.homeDir=${GPG_HOMEDIR} |
| 35 | +signing.gnupg.keyName=${GPG_KEY_ID} |
| 36 | +signing.gnupg.passphrase=${GPG_PASSPHRASE} |
| 37 | +
|
| 38 | +ossrhUsername=${SONATYPE_USERNAME} |
| 39 | +ossrhPassword=${SONATYPE_PASSWORD}" > $1 |
| 40 | +} |
0 commit comments