#!/bin/bash # This script updates the documentation hosted at # https://smithy.io/. There is a y/n prompt before a publish # is performed to allow for a spot-check of the changes. # # This script will run `pip3 install -r requirements.txt` in the docs # directory. If you don't want to globally install dependencies, ensure that # you are first in a virtual environment of some kind before running this # script. set -e #### Load library version #### # Load the version number of the library (used to version javadocs) library_version=$(cat VERSION) library_version=${library_version%%*( )} if [ -z "${library_version}" ]; then echo "Unable to find the version property or it is empty" exit 1 fi #### Clone the docs branch #### # Clone a copy of smithy into a staging directory rm -rf /tmp/_smithy-docs git clone git@github.com:awslabs/smithy.git --branch gh-pages --single-branch /tmp/_smithy-docs cd /tmp/_smithy-docs git checkout gh-pages cd - #### Build javadoc #### ./gradlew javadoc # Always build javadoc into each version. cp -R build/docs/javadoc/* /tmp/_smithy-docs/javadoc/${library_version} # Remove this unnecessary duplicate copy of the docs. rm -rf /tmp/_smithy-docs/javadoc/${library_version}/latest # Create a redirect from "latest" to the version: rm -rf /tmp/_smithy-docs/javadoc/latest mkdir -p /tmp/_smithy-docs/javadoc/latest # Create an HTML redirect from javadoc/latest/ to, for example, javadoc/1.0.0 cat << EOF > /tmp/_smithy-docs/javadoc/latest/index.html