Skip to content

Commit

Permalink
chore: Prepare maven release (#386)
Browse files Browse the repository at this point in the history
* chore: Prepare maven release

* chore: Clean up build.sh

* chore: Clean up build.sh

* chore: Uncomment deploy command
  • Loading branch information
lqiu96 authored Dec 2, 2022
1 parent 387e72f commit 606bab7
Show file tree
Hide file tree
Showing 10 changed files with 550 additions and 137 deletions.
9 changes: 5 additions & 4 deletions api-common-java/.kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fi

echo "Compiling using Java:"
java -version
mvn clean install -B -Dcheckstyle.skip -Dfmt.skip
mvn clean install -B -ntp -DskipTests

# We ensure the generated class files are compatible with Java 8
if [ ! -z "${JAVA8_HOME}" ]; then
Expand All @@ -54,15 +54,16 @@ case ${JOB_TYPE} in
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dcheckstyle.skip=true \
-Dflatten.skip=true \
-Danimal.sniffer.skip=true \
-Dmaven.wagon.http.retryHandler.count=5 \
test
RETURN_CODE=$?
;;
clirr)
mvn -B -ntp -Denforcer.skip=true clirr:check
mvn -B -ntp clirr:check
RETURN_CODE=$?
;;
*) ;;
esac

echo "exiting with ${RETURN_CODE}"
exit ${RETURN_CODE}
13 changes: 0 additions & 13 deletions api-common-java/.kokoro/presubmit/clirr.cfg

This file was deleted.

26 changes: 0 additions & 26 deletions api-common-java/.kokoro/presubmit/common.cfg

This file was deleted.

27 changes: 20 additions & 7 deletions api-common-java/.kokoro/release/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,25 @@ setup_environment_secrets() {
export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|')
}

create_gradle_properties_file() {
create_settings_xml_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
<settings>
<servers>
<server>
<id>ossrh</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>" > $1
}
23 changes: 0 additions & 23 deletions api-common-java/.kokoro/release/publish_javadoc.cfg

This file was deleted.

52 changes: 0 additions & 52 deletions api-common-java/.kokoro/release/publish_javadoc.sh

This file was deleted.

23 changes: 15 additions & 8 deletions api-common-java/.kokoro/release/publish_javadoc11.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -28,21 +28,28 @@ fi
pushd $(dirname "$0")/../../

# install docuploader package
python3 -m pip install gcp-docuploader
python3 -m pip install --require-hashes -r .kokoro/requirements.txt

NAME=api-common
VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3)

# 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 tmp_docs dir and rename index.md
cp README.md tmp_docs/docfx-yml/index.md
# 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 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 \
Expand All @@ -56,4 +63,4 @@ python3 -m docuploader upload . \
--staging-bucket ${STAGING_BUCKET_V2} \
--destination-prefix docfx

popd
popd
25 changes: 21 additions & 4 deletions api-common-java/.kokoro/release/stage.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -27,7 +27,24 @@ 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"
create_settings_xml_file "settings.xml"

./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
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 \
-DperformRelease=true \
--settings=${MAVEN_SETTINGS_FILE}
else
echo "AUTORELEASE_PR is not set. Not releasing."
fi
34 changes: 34 additions & 0 deletions api-common-java/.kokoro/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
gcp-docuploader==0.6.3
google-crc32c==1.3.0
googleapis-common-protos==1.56.3
gcp-releasetool==1.9.1
cryptography==38.0.3
cachetools==4.2.4
cffi==1.15.1
jeepney==0.7.1
jinja2==3.0.3
markupsafe==2.0.1
keyring==23.4.1
packaging==21.3
protobuf==3.19.5
pyjwt==2.4.0
pyparsing==3.0.9
pycparser==2.21
pyperclip==1.8.2
python-dateutil==2.8.2
requests==2.27.1
certifi==2022.9.24
importlib-metadata==4.8.3
zipp==3.6.0
google_api_core==2.8.2
google-cloud-storage==2.0.0
google-resumable-media==2.3.3
google-cloud-core==2.3.1
typing-extensions==4.1.1
urllib3==1.26.12
zipp==3.6.0
rsa==4.9
six==1.16.0
attrs==22.1.0
google-auth==2.14.1
idna==3.4
Loading

0 comments on commit 606bab7

Please sign in to comment.