|
1 | | -#!/bin/bash |
2 | | - |
3 | | -# This script will publish the aggregated javadocs found in the project's "target" directory. |
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, |
6 | | - |
7 | | -# Publish javadocs only for a tagged-release. |
8 | | -if [[ -n "${TRAVIS_TAG}" ]]; then |
9 | | - |
10 | | - printf "\n>>>>> Publishing javadoc for release build: repo=%s release=%s build_num=%s job_num=%s\n" ${TRAVIS_REPO_SLUG} ${TRAVIS_TAG} ${TRAVIS_BUILD_NUMBER} ${TRAVIS_JOB_NUMBER} |
11 | | - |
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/IBM/continuous-delivery-java-sdk.git gh-pages |
15 | | - |
16 | | - printf "\n>>>>> Finished cloning...\n" |
17 | | - |
18 | | - pushd gh-pages |
19 | | - |
20 | | - # Create a new directory for this branch/tag and copy the javadocs there. |
21 | | - printf "\n>>>>> Copying javadocs to new directory: docs/%s\n" ${TRAVIS_TAG} |
22 | | - rm -rf docs/${TRAVIS_TAG} |
23 | | - mkdir -p docs/${TRAVIS_TAG} |
24 | | - cp -rf ../target/site/apidocs/* docs/${TRAVIS_TAG} |
25 | | - |
26 | | - printf "\n>>>>> Generating gh-pages index.html...\n" |
27 | | - ../build/generateJavadocIndex.sh > index.html |
28 | | - |
29 | | - printf "\n>>>>> Committing new javadoc...\n" |
30 | | - git add -f . |
31 | | - git commit -m "docs: latest javadoc for ${TRAVIS_TAG} (${TRAVIS_COMMIT})" |
32 | | - git push -f origin gh-pages |
33 | | - |
34 | | - popd |
35 | | - |
36 | | - printf "\n>>>>> Published javadoc for release build: repo=%s release=%s build_num=%s job_num=%s\n" ${TRAVIS_REPO_SLUG} ${TRAVIS_TAG} ${TRAVIS_BUILD_NUMBER} ${TRAVIS_JOB_NUMBER} |
37 | | - |
38 | | -else |
39 | | - |
40 | | - printf "\n>>>>> Javadoc publishing bypassed for non-release build: repo=%s branch=%s build_num=%s job_num=%s\n" ${TRAVIS_REPO_SLUG} ${TRAVIS_BRANCH} ${TRAVIS_BUILD_NUMBER} ${TRAVIS_JOB_NUMBER} |
41 | | - |
42 | | -fi |
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# This script will publish the aggregated javadocs found in the project's "target" directory. |
| 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, |
| 6 | + |
| 7 | +# Publish javadocs only for a tagged-release. |
| 8 | +if [[ -n "${TRAVIS_TAG}" ]]; then |
| 9 | + |
| 10 | + printf "\n>>>>> Publishing javadoc for release build: repo=%s release=%s build_num=%s job_num=%s\n" ${TRAVIS_REPO_SLUG} ${TRAVIS_TAG} ${TRAVIS_BUILD_NUMBER} ${TRAVIS_JOB_NUMBER} |
| 11 | + |
| 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://${GITHUB_TOKEN}@github.com/IBM/continuous-delivery-java-sdk.git gh-pages |
| 15 | + |
| 16 | + printf "\n>>>>> Finished cloning...\n" |
| 17 | + |
| 18 | + pushd gh-pages |
| 19 | + |
| 20 | + # Create a new directory for this branch/tag and copy the javadocs there. |
| 21 | + printf "\n>>>>> Copying javadocs to new directory: docs/%s\n" ${TRAVIS_TAG} |
| 22 | + rm -rf docs/${TRAVIS_TAG} |
| 23 | + mkdir -p docs/${TRAVIS_TAG} |
| 24 | + cp -rf ../target/site/apidocs/* docs/${TRAVIS_TAG} |
| 25 | + |
| 26 | + printf "\n>>>>> Generating gh-pages index.html...\n" |
| 27 | + ../build/generateJavadocIndex.sh > index.html |
| 28 | + |
| 29 | + printf "\n>>>>> Committing new javadoc...\n" |
| 30 | + git add -f . |
| 31 | + git commit -m "docs: latest javadoc for ${TRAVIS_TAG} (${TRAVIS_COMMIT})" |
| 32 | + git push -f origin gh-pages |
| 33 | + |
| 34 | + popd |
| 35 | + |
| 36 | + printf "\n>>>>> Published javadoc for release build: repo=%s release=%s build_num=%s job_num=%s\n" ${TRAVIS_REPO_SLUG} ${TRAVIS_TAG} ${TRAVIS_BUILD_NUMBER} ${TRAVIS_JOB_NUMBER} |
| 37 | + |
| 38 | +else |
| 39 | + |
| 40 | + printf "\n>>>>> Javadoc publishing bypassed for non-release build: repo=%s branch=%s build_num=%s job_num=%s\n" ${TRAVIS_REPO_SLUG} ${TRAVIS_BRANCH} ${TRAVIS_BUILD_NUMBER} ${TRAVIS_JOB_NUMBER} |
| 41 | + |
| 42 | +fi |
0 commit comments