1#!/bin/bash 2# TODO(bcorso): Consider sharing this script with utils/generate-latest-docs.sh 3 4set -eux 5 6if [ $# -lt 1 ]; then 7 echo "usage $0 <version-name>" 8 exit 1; 9fi 10readonly VERSION_NAME=$1 11shift 1 12 13$(dirname $0)/validate-dagger-version.sh "$VERSION_NAME" 14 15# Publish javadocs to gh-pages 16bazel build //:user-docs.jar 17 18# If a token exists, then use the token to clone the repo. This allows our 19# automated workflows to commit without manually authenticating. 20if [[ ! -z "$GH_TOKEN" ]]; then 21 git clone --quiet --branch=gh-pages https://x-access-token:${GH_TOKEN}@github.com/google/dagger gh-pages > /dev/null 22else 23 git clone --quiet --branch=gh-pages https://github.com/google/dagger gh-pages > /dev/null 24fi 25 26cd gh-pages 27unzip ../bazel-bin/user-docs.jar -d api/$VERSION_NAME 28rm -rf api/$VERSION_NAME/META-INF/ 29git add api/$VERSION_NAME 30git commit -m "$VERSION_NAME docs" 31git push origin gh-pages 32cd .. 33rm -rf gh-pages 34