Fixing release script bugs, making formal releases manual by garrettjonesgoogle · Pull Request #1590 · googleapis/google-cloud-java · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions RELEASING.md
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
<configuration>
<serverId>sonatype-nexus-staging</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
Expand Down
31 changes: 1 addition & 30 deletions utilities/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,8 @@ if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" ]; then
echo "Could not determine the version, so we're exiting."
exit 1
fi
if [ "${SITE_VERSION##*-}" != "SNAPSHOT" ]; then
# Deploy Maven artifacts (if they don't exist yet) and update artifact version in READMEs.
URL=https://oss.sonatype.org/content/repositories/releases/com/google/cloud/google-cloud/$SITE_VERSION/
if curl --output /dev/null --silent --head --fail "$URL"; then
echo "Not deploying artifacts because it seems like they already exist."
echo "Existence was checked using the url $URL"
else
mvn clean deploy --quiet -Djava.util.logging.config.file=logging.properties -DskipITs --settings ~/.m2/settings.xml -P sign-deploy,release
fi
utilities/update_docs_version.sh

# Create website
git config --global user.name "travis-ci"
git config --global user.email "travis@travis-ci.org"
git clone --branch gh-pages --single-branch https://github.com/GoogleCloudPlatform/google-cloud-java/ tmp_gh-pages
mkdir -p tmp_gh-pages/$SITE_VERSION
mvn site -DskipTests=true -Djava.util.logging.config.file=logging.properties
mvn site:stage --quiet -Djava.util.logging.config.file=logging.properties -DtopSiteURL=http://googlecloudplatform.github.io/google-cloud-java/site/${SITE_VERSION}/
cd tmp_gh-pages
cp -r ../target/staging/$SITE_VERSION/* $SITE_VERSION/
sed -i "s/{{SITE_VERSION}}/$SITE_VERSION/g" ${SITE_VERSION}/index.html # Update "Quickstart with Maven" to reflect version change
git add $SITE_VERSION
echo "<html><head><meta http-equiv=\"refresh\" content=\"0; URL='http://GoogleCloudPlatform.github.io/google-cloud-java/${SITE_VERSION}/index.html'\" /></head><body></body></html>" > index.html
git add index.html
echo "<html><head><script>window.location.replace('/google-cloud-java/${SITE_VERSION}/apidocs' + location.search)</script></head><body></body></html>" > apidocs/index.html
git add apidocs/index.html
git commit --quiet -m "Added a new site for version $SITE_VERSION and updated the root directory's redirect. [ci skip]"
git config --global push.default simple
git push --quiet "https://${CI_DEPLOY_USERNAME}:${CI_DEPLOY_PASSWORD}@github.com/GoogleCloudPlatform/google-cloud-java.git" > /dev/null 2>&1
else
mvn clean deploy --quiet -Djava.util.logging.config.file=logging.properties -DskipTests=true -Dgpg.skip=true --settings ~/.m2/settings.xml -P release
mvn clean deploy --quiet -Djava.util.logging.config.file=logging.properties -DskipTests=true -Dgpg.skip=true --settings ~/.m2/settings.xml -P release
fi
else
echo "Not deploying artifacts. This is only done with non-pull-request commits to master branch with Oracle Java 7 builds."
Expand Down
25 changes: 11 additions & 14 deletions utilities/create_site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,31 @@
set -e

SITE_VERSION=$1
SITE_VERSION_BASE=$(sed -r 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/' <<< "$SITE_VERSION")

echo "Creating docs for google-cloud-java $SITE_VERSION"
echo "Creating site for google-cloud-java $SITE_VERSION_BASE"

if [ -z "$SITE_VERSION" ]; then
if [ -z "$SITE_VERSION_BASE" ]; then
echo "First arg (version) not provided, so we're exiting."
exit 1
fi

git clone --branch gh-pages --single-branch https://github.com/GoogleCloudPlatform/google-cloud-java/ tmp_gh-pages
mkdir -p tmp_gh-pages/$SITE_VERSION
mkdir -p tmp_gh-pages/$SITE_VERSION_BASE
mvn site -DskipTests=true -Djava.util.logging.config.file=logging.properties
mvn site:stage --quiet -Djava.util.logging.config.file=logging.properties -DtopSiteURL=http://googlecloudplatform.github.io/google-cloud-java/site/${SITE_VERSION}/
mvn site:stage --quiet -Djava.util.logging.config.file=logging.properties -DtopSiteURL=http://googlecloudplatform.github.io/google-cloud-java/site/${SITE_VERSION_BASE}/
cd tmp_gh-pages

for dir in ../target/staging/${SITE_VERSION}*
for dir in ../target/staging/${SITE_VERSION_BASE}*
do
cp -r ${dir}/* $SITE_VERSION/
cp -r ${dir}/* $SITE_VERSION_BASE/
done

sed -i "s/{{SITE_VERSION}}/$SITE_VERSION/g" ${SITE_VERSION}/index.html # Update "Quickstart with Maven" to reflect version change
git add $SITE_VERSION
echo "<html><head><meta http-equiv=\"refresh\" content=\"0; URL='http://GoogleCloudPlatform.github.io/google-cloud-java/${SITE_VERSION}/index.html'\" /></head><body></body></html>" > index.html
sed -i "s/{{SITE_VERSION}}/$SITE_VERSION/g" ${SITE_VERSION_BASE}/index.html # Update "Quickstart with Maven" to reflect version change
git add $SITE_VERSION_BASE
echo "<html><head><meta http-equiv=\"refresh\" content=\"0; URL='http://GoogleCloudPlatform.github.io/google-cloud-java/${SITE_VERSION_BASE}/index.html'\" /></head><body></body></html>" > index.html
git add index.html
echo "<html><head><script>window.location.replace('/google-cloud-java/${SITE_VERSION}/apidocs' + location.search)</script></head><body></body></html>" > apidocs/index.html
echo "<html><head><script>window.location.replace('/google-cloud-java/${SITE_VERSION_BASE}/apidocs' + location.search)</script></head><body></body></html>" > apidocs/index.html
git add apidocs/index.html

echo "Site generated under tmp_gh-pages/. The changes must be committed from that directory."
echo "Recommended commands: (this will push the new site to the gh-pages branch)"
echo " cd tmp_gh-pages"
echo " git commit -m \"Added a new site for version $SITE_VERSION and updated the root directory's redirect. [ci skip]\""
echo " git push"
4 changes: 2 additions & 2 deletions utilities/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

SITE_VERSION=$1

if [ -n $SITE_VERSION ]; then
if [ -z $SITE_VERSION ]; then
echo "First arg (version) not provided, so we're exiting."
exit 1
fi
Expand All @@ -20,6 +20,6 @@ else
echo "Existence was checked using the url $URL"
else
echo "Deploying Release artifacts..."
mvn clean deploy --quiet -Djava.util.logging.config.file=logging.properties -DskipITs --settings ~/.m2/settings.xml -P sign-deploy,release
mvn clean deploy --quiet -Djava.util.logging.config.file=logging.properties -DskipTests=true --settings ~/.m2/settings.xml -P release
fi
fi
12 changes: 12 additions & 0 deletions utilities/finalize_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

mvn nexus-staging:release

# Push the version and README updates
git push

# Push the gh-pages updates
cd tmp_gh-pages
git push
4 changes: 2 additions & 2 deletions utilities/release.sh → utilities/stage_release.sh