Skip to content

Instantly share code, notes, and snippets.

@gundalow
Last active April 10, 2019 16:00
Show Gist options
  • Save gundalow/24ca71cdb32318898ccb3a8a787a8891 to your computer and use it in GitHub Desktop.
Save gundalow/24ca71cdb32318898ccb3a8a787a8891 to your computer and use it in GitHub Desktop.
#!/bin/bash -xe
VIRTUAL_ENV="${JENKINS_HOME}/VirtualEnvs/${JOB_NAME}"
. "${VIRTUAL_ENV}/bin/activate"
RSYNC_OPTS="-a --delete --progress --exclude=.repo.lock --exclude .git/\*"
RSYNC_RSH="ssh -o User=jenkins"
# By default we go to docs.testing.ansible.com dir
RSYNC_TARGET="${ANSIBLE_NIGHTLY_DOCS_PATH}"
if [ "$OFFICIAL" = "yes" ]; then
# Copy into docs.ansible.com dir
RSYNC_TARGET="${ANSIBLE_RELEASE_DOCS_PATH}"
fi
# Get the version in the form 2.7
# Note: this will return 2.8 (not devel)
VERSION=$(make version -B | cut -f 1-2 -d .)
make webdocs
if [ "${GIT_BRANCH}" == "origin/devel" ]; then
# We are using devel, not 2.?
VERSION=devel
fi
rsync ${RSYNC_OPTS} --rsh "${RSYNC_RSH}" docs/docsite/_build/html/ "${RSYNC_TARGET}/$VERSION/"
if [ "${OLD_VERSION}" == "no" ]; then
# Add latest symlink
ln -s $VERSION docs/docsite/_build/latest
rsync ${RSYNC_OPTS} --rsh "${RSYNC_RSH}" docs/docsite/_build/latest "${RSYNC_TARGET}"
fi
# Sync releases mirrors
if [[ ( "$OFFICIAL" == "yes" ) || ( "$GIT_BRANCH" == "origin/devel" ) ]]; then
echo -e "build" > sync_releases.cfg
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment