|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2019 Google LLC |
| 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 | +if [[ -n "${AUTORELEASE_PR}" ]] |
| 19 | +then |
| 20 | + # Start the releasetool reporter |
| 21 | + requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) |
| 22 | + python3 -m pip install --require-hashes -r $requirementsFile |
| 23 | + python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script |
| 24 | +fi |
| 25 | + |
| 26 | +source $(dirname "$0")/common.sh |
| 27 | +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml |
| 28 | +pushd $(dirname "$0")/../../ |
| 29 | + |
| 30 | +setup_environment_secrets |
| 31 | +create_settings_xml_file "settings.xml" |
| 32 | + |
| 33 | +mvn clean deploy -B \ |
| 34 | + -DskipTests=true \ |
| 35 | + -Dclirr.skip=true \ |
| 36 | + --settings ${MAVEN_SETTINGS_FILE} \ |
| 37 | + -Dgpg.executable=gpg \ |
| 38 | + -Dgpg.passphrase=${GPG_PASSPHRASE} \ |
| 39 | + -Dgpg.homedir=${GPG_HOMEDIR} \ |
| 40 | + -P release |
| 41 | + |
| 42 | +# The job triggered by Release Please (release-trigger) has this AUTORELEASE_PR |
| 43 | +# environment variable. Fusion also lets us to specify this variable. |
| 44 | +if [[ -n "${AUTORELEASE_PR}" ]] |
| 45 | +then |
| 46 | + mvn nexus-staging:release -B \ |
| 47 | + -P release-staging-repository \ |
| 48 | + -DperformRelease=true \ |
| 49 | + --settings=${MAVEN_SETTINGS_FILE} |
| 50 | +else |
| 51 | + echo "AUTORELEASE_PR is not set. Not releasing." |
| 52 | +fi |
0 commit comments