|
2 | 2 |
|
3 | 3 | # This script will publish the aggregated javadocs found in the project's "target" directory.
|
4 | 4 | # The javadocs are committed and pushed to the git repository's gh-pages branch.
|
5 |
| -# Be sure to customize this file to reflect your SDK project's settings (git url, |
| 5 | +# Be sure to customize this file to reflect your SDK project's settings |
6 | 6 |
|
7 |
| -export GHA_BRANCH=${GHA_BRANCH##*/} # Get the last part for true branch name - "refs/heads/9260_gha" |
8 |
| -# Avoid publishing javadocs for a PR build |
9 |
| -if [ "$GHA_PULL_REQUEST" == "false" ] && [ "$GHA_BRANCH" ]; then |
10 |
| - printf "\n>>>>> Publishing javadoc for release build: repo=%s branch=%s build_num=%s job_num=%s pr=%s tag=%s commit=%s\n" ${GHA_REPO_SLUG} ${GHA_BRANCH} ${GHA_BUILD_NUMBER} ${GHA_JOB_NUMBER} ${GHA_PULL_REQUEST} ${GHA_TAG} ${GHA_COMMIT} |
| 7 | +export GHA_TAG=${GHA_TAG##*/} # Get the last part for true tag name - "refs/heads/vx.x.x" |
| 8 | +printf "\n>>>>> Publishing javadoc for release build: %s\n" ${GHA_TAG} |
11 | 9 |
|
12 |
| - printf "\n>>>>> Cloning repository's gh-pages branch into directory 'gh-pages'\n" |
13 |
| - rm -fr ./gh-pages |
14 |
| - git clone --branch=gh-pages https://${GH_TOKEN}@github.com/watson-developer-cloud/java-sdk.git gh-pages > /dev/null |
| 10 | +printf "\n>>>>> Cloning repository's gh-pages branch into directory 'gh-pages'\n" |
| 11 | +rm -fr ./gh-pages |
| 12 | +git clone --branch=gh-pages https://${GH_TOKEN}@github.com/watson-developer-cloud/java-sdk.git gh-pages > /dev/null |
| 13 | +printf "\n>>>>> Finished cloning...\n" |
15 | 14 |
|
16 |
| - printf "\n>>>>> Finished cloning...\n" |
17 |
| - |
18 |
| - pushd gh-pages |
| 15 | +pushd gh-pages |
19 | 16 |
|
20 |
| - # Create a new directory for this branch/tag and copy the aggregated javadocs there. |
21 |
| - printf "\n>>>>> Copying aggregated javadocs to new tagged-release directory: %s\n" ${GHA_BRANCH} |
22 |
| - rm -rf docs/${GHA_BRANCH} |
23 |
| - mkdir -p docs/${GHA_BRANCH} |
24 |
| - cp -rf ../target/site/apidocs/* docs/${GHA_BRANCH} |
25 |
| - |
26 |
| - printf "\n>>>>> Generating gh-pages index.html...\n" |
27 |
| - ../build/generateJavadocIndex.sh > index.html |
28 |
| - |
29 |
| - # Update the 'latest' symlink to point to this branch if it's a tagged release. |
30 |
| - if [ -n "$GHA_TAG" ]; then |
31 |
| - pushd docs |
32 |
| - rm latest |
33 |
| - ln -s ./${GHA_TAG} latest |
34 |
| - printf "\n>>>>> Updated 'docs/latest' symlink:\n" |
35 |
| - ls -l latest |
36 |
| - popd |
37 |
| - fi |
38 |
| - |
39 |
| - printf "\n>>>>> Committing new javadoc...\n" |
40 |
| - git add -f . |
41 |
| - git commit -m "Javadoc for release ${GHA_TAG} (${GHA_COMMIT})" |
42 |
| - git push -f origin gh-pages |
43 |
| - |
44 |
| - popd |
45 |
| - |
46 |
| - printf "\n>>>>> Published javadoc for release build: repo=%s branch=%s build_num=%s job_num=%s\n" ${GHA_REPO_SLUG} ${GHA_BRANCH} ${GHA_BUILD_NUMBER} ${GHA_JOB_NUMBER} |
47 |
| - |
48 |
| -else |
49 |
| - |
50 |
| - printf "\n>>>>> Javadoc publishing bypassed for non-release build: repo=%s branch=%s build_num=%s job_num=%s pr=%s tag=%s commit=%s\n" ${GHA_REPO_SLUG} ${GHA_BRANCH} ${GHA_BUILD_NUMBER} ${GHA_JOB_NUMBER} ${GHA_PULL_REQUEST} ${GHA_TAG} ${GHA_COMMIT} |
51 |
| - |
52 |
| -fi |
| 17 | +# Create a new directory for this branch/tag and copy the aggregated javadocs there. |
| 18 | +printf "\n>>>>> Copying aggregated javadocs to new tagged-release directory: %s\n" ${GHA_TAG} |
| 19 | +rm -rf docs/${GHA_TAG} |
| 20 | +mkdir -p docs/${GHA_TAG} |
| 21 | +cp -rf ../target/site/apidocs/* docs/${GHA_TAG} |
| 22 | + |
| 23 | +printf "\n>>>>> Generating gh-pages index.html...\n" |
| 24 | +../build/generateJavadocIndex.sh > index.html |
| 25 | + |
| 26 | +# Update the 'latest' symlink to point to this branch if it's a tagged release. |
| 27 | +pushd docs |
| 28 | +rm latest |
| 29 | +ln -s ./${GHA_TAG} latest |
| 30 | +printf "\n>>>>> Updated 'docs/latest' symlink:\n" |
| 31 | +ls -l latest |
| 32 | +popd |
| 33 | + |
| 34 | +printf "\n>>>>> Committing new javadoc for commit: %s\n" ${GHA_COMMIT} |
| 35 | +git add -f . |
| 36 | +git commit -m "chore: Javadoc for release ${GHA_TAG} (${GHA_COMMIT})" |
| 37 | +git push -f origin gh-pages |
| 38 | + |
| 39 | +popd |
0 commit comments