From 7cd7e13b3a54e4c89010a0f35c6cb36d0799726d Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Wed, 30 Nov 2022 15:27:56 -0500 Subject: [PATCH] chore: Release with maven (#1894) * chore: Release with maven * chore: Update configs * chore: Remove maven_build.sh file * chore: Prepare maven release * chore: Clean up build file --- .github/workflows/ci.yaml | 21 +----- .kokoro/build.sh | 40 +++++------ .kokoro/maven-build.sh | 72 ------------------- .kokoro/release/common.sh | 13 +--- .kokoro/release/drop.cfg | 5 -- .kokoro/release/drop.sh | 19 ----- .kokoro/release/promote.cfg | 5 -- .kokoro/release/promote.sh | 31 --------- .kokoro/release/publish_javadoc.cfg | 19 ----- .kokoro/release/publish_javadoc.sh | 52 -------------- .kokoro/release/publish_javadoc11.cfg | 1 - .kokoro/release/publish_javadoc11.sh | 31 +++++++-- .kokoro/release/publish_javadoc11_maven.cfg | 31 --------- .kokoro/release/publish_javadoc11_maven.sh | 77 --------------------- .kokoro/release/stage.cfg | 7 ++ .kokoro/release/stage.sh | 63 ++++++++++------- .kokoro/release/stage_gradle.cfg | 17 ----- .kokoro/release/stage_gradle.sh | 39 ----------- .kokoro/release/stage_maven.cfg | 17 ----- .kokoro/release/stage_maven.sh | 53 -------------- license-checks.xml | 2 +- pom.xml | 23 ++++++ 22 files changed, 113 insertions(+), 525 deletions(-) delete mode 100755 .kokoro/maven-build.sh delete mode 100644 .kokoro/release/drop.cfg delete mode 100755 .kokoro/release/drop.sh delete mode 100644 .kokoro/release/promote.cfg delete mode 100755 .kokoro/release/promote.sh delete mode 100644 .kokoro/release/publish_javadoc.cfg delete mode 100755 .kokoro/release/publish_javadoc.sh delete mode 100644 .kokoro/release/publish_javadoc11_maven.cfg delete mode 100755 .kokoro/release/publish_javadoc11_maven.sh delete mode 100644 .kokoro/release/stage_gradle.cfg delete mode 100755 .kokoro/release/stage_gradle.sh delete mode 100644 .kokoro/release/stage_maven.cfg delete mode 100755 .kokoro/release/stage_maven.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3a1465909..b05c1da3d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,28 +19,9 @@ jobs: distribution: temurin java-version: 11 - run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV - - run: .kokoro/maven-build.sh + - run: .kokoro/build.sh env: JOB_TYPE: clirr - maven-units: - name: "maven unit tests" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - java-version: 8 - distribution: zulu - - run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV - - uses: actions/setup-java@v3 - with: - java-version: 11 - distribution: zulu - - run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV - - run: printenv - - run: .kokoro/maven-build.sh - env: - JOB_TYPE: test units-java11: name: "units (11)" runs-on: ubuntu-latest diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 9c25171ab..a9e909f0d 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2018 Google Inc. +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -34,29 +34,27 @@ if [ ! -z "${JAVA11_HOME}" ]; then setJava "${JAVA11_HOME}" fi -echo "Compiling using Java:" -java -version -echo -./gradlew compileJava compileTestJava javadoc +mvn -V -B -ntp clean install -DskipTests # We ensure the generated class files are compatible with Java 8 if [ ! -z "${JAVA8_HOME}" ]; then setJava "${JAVA8_HOME}" fi -echo "Running tests using Java:" -java -version - -if [ "${GITHUB_JOB}" == "units-java8" ]; then - java -version 2>&1 | grep -q 'openjdk version "1.8.' - MATCH=$? # 0 if the output has the match - if [ "$MATCH" != "0" ]; then - echo "Please specify JDK 8 for Java 8 tests" - exit 1 - fi -fi - -echo -./gradlew build publishToMavenLocal \ - --exclude-task compileJava --exclude-task compileTestJava \ - --exclude-task javadoc +RETURN_CODE=0 + +case "${JOB_TYPE}" in +test) + # run tests in Java 8 with the source compiled in Java 11 + mvn -V -B -ntp surefire:test + RETURN_CODE=$? + ;; +clirr) + mvn -B -ntp clirr:check + RETURN_CODE=$? + ;; +*) ;; +esac + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} \ No newline at end of file diff --git a/.kokoro/maven-build.sh b/.kokoro/maven-build.sh deleted file mode 100755 index f8a1511ef..000000000 --- a/.kokoro/maven-build.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) -# cd to the parent directory, i.e. the root of the git repo -cd ${scriptDir}/.. - -echo $JOB_TYPE - -function setJava() { - export JAVA_HOME=$1 - export PATH=${JAVA_HOME}/bin:$PATH -} - -# This project requires compiling the classes in JDK 11 or higher for GraalVM -# classes. Compiling this project with Java 8 or earlier would fail with "class -# file has wrong version 55.0, should be 53.0" and "unrecognized --release 8 -# option" (set in build.gradle). -if [ ! -z "${JAVA11_HOME}" ]; then - setJava "${JAVA11_HOME}" -fi - -echo "Compiling using Java:" -java -version -echo -mvn -V -B -ntp clean install -DskipTests -Dclirr.skip=true -Denforcer.skip=true - -# We ensure the generated class files are compatible with Java 8 -if [ ! -z "${JAVA8_HOME}" ]; then - setJava "${JAVA8_HOME}" -fi - -if [ "${GITHUB_JOB}" == "units-java8" ]; then - java -version 2>&1 | grep -q 'openjdk version "1.8.' - MATCH=$? # 0 if the output has the match - if [ "$MATCH" != "0" ]; then - echo "Please specify JDK 8 for Java 8 tests" - exit 1 - fi -fi - -RETURN_CODE=0 - -case "${JOB_TYPE}" in -test) - # run tests in Java 8 with the source compiled in Java 11 - mvn -V -B -ntp surefire:test -Dclirr.skip=true -Denforcer.skip=true - RETURN_CODE=$? - ;; -clirr) - mvn -B -ntp -Denforcer.skip=true clirr:check - RETURN_CODE=$? - ;; -*) ;; -esac - -echo "exiting with ${RETURN_CODE}" -exit ${RETURN_CODE} \ No newline at end of file diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh index a594cfb28..693bae8bf 100755 --- a/.kokoro/release/common.sh +++ b/.kokoro/release/common.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019 Google Inc. +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,17 +28,6 @@ setup_environment_secrets() { export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') } -create_gradle_properties_file() { - echo " -signing.gnupg.executable=gpg -signing.gnupg.homeDir=${GPG_HOMEDIR} -signing.gnupg.keyName=${GPG_KEY_ID} -signing.gnupg.passphrase=${GPG_PASSPHRASE} - -ossrhUsername=${SONATYPE_USERNAME} -ossrhPassword=${SONATYPE_PASSWORD}" > $1 -} - create_settings_xml_file() { echo " diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg deleted file mode 100644 index 32f2ec33a..000000000 --- a/.kokoro/release/drop.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/drop.sh" -} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh deleted file mode 100755 index ce6ae7543..000000000 --- a/.kokoro/release/drop.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Copyright 2019 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -echo "This dropping a staged repo does not appear supported by the gradle-nexus-staging-plugin" -exit 1 diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg deleted file mode 100644 index e644fd395..000000000 --- a/.kokoro/release/promote.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/promote.sh" -} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh deleted file mode 100755 index 2dcfd256d..000000000 --- a/.kokoro/release/promote.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright 2019 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# STAGING_REPOSITORY_ID must be set -#if [ -z "${STAGING_REPOSITORY_ID}" ]; then -# echo "Missing STAGING_REPOSITORY_ID environment variable" -# exit 1 -#fi - -source $(dirname "$0")/common.sh -pushd $(dirname "$0")/../../ - -setup_environment_secrets -mkdir -p ${HOME}/.gradle -create_gradle_properties_file "${HOME}/.gradle/gradle.properties" - -./gradlew closeAndReleaseRepository diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg deleted file mode 100644 index 403ca6ad6..000000000 --- a/.kokoro/release/publish_javadoc.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto -env_vars: { - key: "STAGING_BUCKET" - value: "docs-staging" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/publish_javadoc.sh" -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh deleted file mode 100755 index 08f6add6b..000000000 --- a/.kokoro/release/publish_javadoc.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# Copyright 2019 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET}" ]]; then - echo "Need to set STAGING_BUCKET environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install --require-hashes -r .kokoro/requirements.txt - -NAME=gax -VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -# build the docs -./gradlew javadocCombined - -pushd tmp_docs - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --language java - -# upload docs -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET} - -popd diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg index 43a768b22..4bfabf6d0 100644 --- a/.kokoro/release/publish_javadoc11.cfg +++ b/.kokoro/release/publish_javadoc11.cfg @@ -1,6 +1,5 @@ # Format: //devtools/kokoro/config/proto/build.proto -# cloud-rad production env_vars: { key: "STAGING_BUCKET_V2" value: "docs-staging-v2" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh index 2a65a432f..2a6fb8291 100755 --- a/.kokoro/release/publish_javadoc11.sh +++ b/.kokoro/release/publish_javadoc11.sh @@ -1,6 +1,5 @@ #!/bin/bash -# Copyright 2019 Google Inc. -# +# Copyright 2019 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -33,16 +32,34 @@ python3 -m pip install --require-hashes -r .kokoro/requirements.txt NAME=gax VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) +mvn -B -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dcheckstyle.skip=true \ + -Dflatten.skip=true \ + -Danimal.sniffer.skip=true \ + -DskipTests=true \ + -Djacoco.skip=true \ + install + # build the docs -./gradlew javadocCombinedV3 +mvn -B -ntp \ + -P docFX \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dcheckstyle.skip=true \ + -Dflatten.skip=true \ + -Danimal.sniffer.skip=true \ + javadoc:aggregate # copy README to docfx-yml dir and rename index.md -cp README.md tmp_docs/docfx-yml/index.md +cp README.md target/docfx-yml/index.md # copy CHANGELOG to docfx-yml dir and rename history.md -cp CHANGELOG.md tmp_docs/docfx-yml/history.md +cp CHANGELOG.md target/docfx-yml/history.md -pushd tmp_docs/docfx-yml/ +pushd target/docfx-yml/ # create metadata python3 -m docuploader create-metadata \ @@ -56,4 +73,4 @@ python3 -m docuploader upload . \ --staging-bucket ${STAGING_BUCKET_V2} \ --destination-prefix docfx -popd +popd \ No newline at end of file diff --git a/.kokoro/release/publish_javadoc11_maven.cfg b/.kokoro/release/publish_javadoc11_maven.cfg deleted file mode 100644 index a47de9772..000000000 --- a/.kokoro/release/publish_javadoc11_maven.cfg +++ /dev/null @@ -1,31 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# cloud-rad dev -# TODO: Update this or publish_javadoc11.sh to the prod bucket -env_vars: { - key: "STAGING_BUCKET_V2" - value: "docs-staging-v2-dev" -} - -# Configure the docker image for kokoro-trampoline -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java11" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/publish_javadoc11_maven.sh" -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/ -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx" diff --git a/.kokoro/release/publish_javadoc11_maven.sh b/.kokoro/release/publish_javadoc11_maven.sh deleted file mode 100755 index 52f152693..000000000 --- a/.kokoro/release/publish_javadoc11_maven.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# Copyright 2022 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET_V2}" ]]; then - echo "Need to set STAGING_BUCKET environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install --require-hashes -r .kokoro/requirements.txt - -NAME=gax -VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -mvn -B -ntp \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dcheckstyle.skip=true \ - -Dflatten.skip=true \ - -Danimal.sniffer.skip=true \ - -DskipTests=true \ - -Djacoco.skip=true \ - install - -# build the docs -mvn -B -ntp \ - -P docFX \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dcheckstyle.skip=true \ - -Dflatten.skip=true \ - -Danimal.sniffer.skip=true \ - javadoc:aggregate - -# copy README to docfx-yml dir and rename index.md -cp README.md target/docfx-yml/index.md - -# copy CHANGELOG to docfx-yml dir and rename history.md -cp CHANGELOG.md target/docfx-yml/history.md - -pushd target/docfx-yml/ - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --language java - -## upload docs -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET_V2} \ - --destination-prefix docfx - -popd \ No newline at end of file diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg index ea8114821..b08c75908 100644 --- a/.kokoro/release/stage.cfg +++ b/.kokoro/release/stage.cfg @@ -4,6 +4,13 @@ env_vars: { value: "github/gax-java/.kokoro/release/stage.sh" } +action { + define_artifacts { + regex: "github/gax-java/target/nexus-staging/staging/*.properties" + strip_prefix: "github/gax-java" + } +} + env_vars: { key: "SECRET_MANAGER_KEYS" value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh index 2a93d85cd..5ff691d31 100755 --- a/.kokoro/release/stage.sh +++ b/.kokoro/release/stage.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019 Google Inc. +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,29 +13,40 @@ # See the License for the specific language governing permissions and # limitations under the License. -echo "Running `stage.sh`. Invoking stage_gradle and stage_maven" +set -eo pipefail -#set -eo pipefail -# -#if [[ -n "${AUTORELEASE_PR}" ]] -#then -# # Start the releasetool reporter -# requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) -# python3 -m pip install --require-hashes -r $requirementsFile -# python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script -#fi -# -#source $(dirname "$0")/common.sh -#MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml -#pushd $(dirname "$0")/../../ -# -#setup_environment_secrets -#mkdir -p ${HOME}/.gradle -#create_gradle_properties_file "${HOME}/.gradle/gradle.properties" -# -#if [[ -z "${AUTORELEASE_PR}" ]] -#then -# ./gradlew publishToSonatype -#else -# ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -#fi +if [[ -n "${AUTORELEASE_PR}" ]] +then + # Start the releasetool reporter + requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) + python3 -m pip install --require-hashes -r $requirementsFile + python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script +fi + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean deploy -B \ + -DskipTests=true \ + -Dclirr.skip=true \ + --settings ${MAVEN_SETTINGS_FILE} \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} \ + -P release + +# The job triggered by Release Please (release-trigger) has this AUTORELEASE_PR +# environment variable. Fusion also lets us to specify this variable. +if [[ -n "${AUTORELEASE_PR}" ]] +then + mvn nexus-staging:release -B \ + -P release-staging-repository \ + -DperformRelease=true \ + --settings=${MAVEN_SETTINGS_FILE} +else + echo "AUTORELEASE_PR is not set. Not releasing." +fi diff --git a/.kokoro/release/stage_gradle.cfg b/.kokoro/release/stage_gradle.cfg deleted file mode 100644 index b08c75908..000000000 --- a/.kokoro/release/stage_gradle.cfg +++ /dev/null @@ -1,17 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/stage.sh" -} - -action { - define_artifacts { - regex: "github/gax-java/target/nexus-staging/staging/*.properties" - strip_prefix: "github/gax-java" - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} diff --git a/.kokoro/release/stage_gradle.sh b/.kokoro/release/stage_gradle.sh deleted file mode 100755 index 221d8f346..000000000 --- a/.kokoro/release/stage_gradle.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# Copyright 2022 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -n "${AUTORELEASE_PR}" ]] -then - # Start the releasetool reporter - requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) - python3 -m pip install --require-hashes -r $requirementsFile - python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script -fi - -source $(dirname "$0")/common.sh -MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml -pushd $(dirname "$0")/../../ - -setup_environment_secrets -mkdir -p ${HOME}/.gradle -create_gradle_properties_file "${HOME}/.gradle/gradle.properties" - -if [[ -z "${AUTORELEASE_PR}" ]] -then - ./gradlew publishToSonatype -else - ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -fi diff --git a/.kokoro/release/stage_maven.cfg b/.kokoro/release/stage_maven.cfg deleted file mode 100644 index e7a8e8a0d..000000000 --- a/.kokoro/release/stage_maven.cfg +++ /dev/null @@ -1,17 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/stage_maven.sh" -} - -action { - define_artifacts { - regex: "github/gax-java/target/nexus-staging/staging/*.properties" - strip_prefix: "github/gax-java" - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} diff --git a/.kokoro/release/stage_maven.sh b/.kokoro/release/stage_maven.sh deleted file mode 100755 index 9bef3cd1a..000000000 --- a/.kokoro/release/stage_maven.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# Copyright 2022 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -n "${AUTORELEASE_PR}" ]] -then - # Start the releasetool reporter - requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) - python3 -m pip install --require-hashes -r $requirementsFile - python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script -fi - -source $(dirname "$0")/common.sh -MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn clean deploy -B \ - -DskipTests=true \ - -Dclirr.skip=true \ - --settings ${MAVEN_SETTINGS_FILE} \ - -Dgpg.executable=gpg \ - -Dgpg.passphrase=${GPG_PASSPHRASE} \ - -Dgpg.homedir=${GPG_HOMEDIR} \ - -P release - -# TODO: The step below will release the artifact to maven central. Uncomment when ready - -## The job triggered by Release Please (release-trigger) has this AUTORELEASE_PR -## environment variable. Fusion also lets us to specify this variable. -#if [[ -n "${AUTORELEASE_PR}" ]] -#then -# mvn nexus-staging:release -B \ -# -DperformRelease=true \ -# --settings=${MAVEN_SETTINGS_FILE} -#else -# echo "AUTORELEASE_PR is not set. Not releasing." -#fi diff --git a/license-checks.xml b/license-checks.xml index 574f1d42f..362833222 100644 --- a/license-checks.xml +++ b/license-checks.xml @@ -5,6 +5,6 @@ - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index dca689af1..16ff3c008 100644 --- a/pom.xml +++ b/pom.xml @@ -259,4 +259,27 @@ + + + + + release-staging-repository + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + sonatype-nexus-staging + https://google.oss.sonatype.org/ + false + + + + + + \ No newline at end of file