Skip to content

Commit

Permalink
Deploy snapshot docs in a separate action
Browse files Browse the repository at this point in the history
(merge main -> ce/main 103368)

[git-p4: depot-paths = "//dev/coherence-ce/main/": change = 103369]
  • Loading branch information
thegridman committed Sep 19, 2023
1 parent 51df44a commit 0680ef2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 24 deletions.
49 changes: 49 additions & 0 deletions tools/bin/github-deploy-snapshot-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh
set -e
#
# Copyright (c) 2000, 2022, Oracle and/or its affiliates.
#
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.
#

CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)

if [ "${CURRENT_VERSION}" = "" ]; then
echo "Could not find current version from Maven"
exit 1
fi

echo "${CURRENT_VERSION}" | grep -q "SNAPSHOT"
if [ $? != 0 ] ; then
echo "This job only deploys SNAPSHOT versions, skipping version ${CURRENT_VERSION}"
exit 0
fi

echo "Building version ${CURRENT_VERSION}"
mvn -B clean install -Dproject.official=true -P-modules --file prj/pom.xml -DskipTests -s .github/maven/settings.xml
mvn -B clean install -Dproject.official=true -Pmodules,-coherence,docs -nsu --file prj/pom.xml -DskipTests -s .github/maven/settings.xml

echo "Deploying docs for version ${CURRENT_VERSION}"
git stash save --keep-index --include-untracked || true
git stash drop || true
git checkout gh-pages
git config pull.rebase true
git pull

rm -rf "${CURRENT_VERSION}" || true
mkdir -p "${CURRENT_VERSION}"/api || true
mv prj/coherence-javadoc/target/javadoc/apidocs "${CURRENT_VERSION}"/api/java
mv prj/docs/target/docs "${CURRENT_VERSION}"/docs
git add -A "${CURRENT_VERSION}"/*

if [ "${HEAD_BRANCH}" = "master" ]; then
echo "Deploying docs for version ${CURRENT_VERSION} to latest-snapshot"
rm -rf latest-snapshot || true
cp -R "${CURRENT_VERSION}" latest-snapshot
git add -A latest-snapshot/*
fi

echo "Pushing docs for ${CURRENT_VERSION} to gh-pages"
git commit -m "Update ${CURRENT_VERSION} docs"
git push origin gh-pages
24 changes: 0 additions & 24 deletions tools/bin/github-deploy-snapshots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,3 @@ mvn -B clean install -Dproject.official=true -Pmodules,-coherence,docs -nsu --fi
echo "Deploying version ${CURRENT_VERSION}"
mvn -B clean deploy -Dproject.official=true -P-modules -nsu --file prj/pom.xml -DskipTests -s .github/maven/settings.xml
mvn -B clean deploy -Dproject.official=true -Pmodules,-coherence,docs -nsu --file prj/pom.xml -DskipTests -s .github/maven/settings.xml

echo "Deploying docs for version ${CURRENT_VERSION}"
git stash save --keep-index --include-untracked || true
git stash drop || true
git checkout gh-pages
git config pull.rebase true
git pull

rm -rf "${CURRENT_VERSION}" || true
mkdir -p "${CURRENT_VERSION}"/api || true
mv prj/coherence-javadoc/target/javadoc/apidocs "${CURRENT_VERSION}"/api/java
mv prj/docs/target/docs "${CURRENT_VERSION}"/docs
git add -A "${CURRENT_VERSION}"/*

if [ "${HEAD_BRANCH}" = "master" ]; then
echo "Deploying docs for version ${CURRENT_VERSION} to latest-snapshot"
rm -rf latest-snapshot || true
cp -R "${CURRENT_VERSION}" latest-snapshot
git add -A latest-snapshot/*
fi

echo "Pushing docs for ${CURRENT_VERSION} to gh-pages"
git commit -m "Update ${CURRENT_VERSION} docs"
git push origin gh-pages

0 comments on commit 0680ef2

Please sign in to comment.