diff options
author | 2016-05-24 18:22:22 +0000 | |
---|---|---|
committer | 2016-05-25 08:34:52 +0000 | |
commit | 1164a4f9db8d2b66d005bfa340ed76fd5f89fb00 (patch) | |
tree | 28ad07e3e180f22c9c11deb9bc65e8b568bd1ddb /scripts | |
parent | 70b29f45119966a11c613459d71ee221e8f71a24 (diff) |
Push documentation to GCS instead of Github pages.
www.bazel.io is now served from GCS and this change
archive the site on CI and adds a function to do the
push to GCS.
Another change to github pages is needed to redirect
http://bazel.io to http://www.bazel.io and a
change to ci.bazel.io to add the job that calls the
added method.
Moving towards #47.
--
MOS_MIGRATED_REVID=123126457
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/ci/build.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 1ca6017c5a..2b04a0bf6f 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -139,6 +139,7 @@ function bazel_build() { --workspace_status_command=scripts/ci/build_status_command.sh \ --define JAVA_VERSION=${JAVA_VERSION} \ ${ARGS} \ + //site:jekyll-tree \ //scripts/packages/... || exit $? if [ -n "${1-}" ]; then @@ -149,6 +150,7 @@ function bazel_build() { if [ "$PLATFORM" = "linux" ]; then cp bazel-bin/scripts/packages/bazel-debian.deb $1/bazel_${release_label}.deb fi + cp bazel-genfiles/site/jekyll-tree.tar $1/www.bazel.io.tar cp bazel-genfiles/scripts/packages/README.md $1/README.md fi @@ -432,3 +434,26 @@ function bazel_release() { export RELEASE_EMAIL_SUBJECT="$(echo "${RELEASE_EMAIL}" | head -2 | tail -1)" export RELEASE_EMAIL_CONTENT="$(echo "${RELEASE_EMAIL}" | tail -n +3)" } + +# Use jekyll build to build the site and then gsutil to copy it to GCS +# Input: $1 tarball to the jekyll site +# $2 name of the bucket to deploy the site to +# It requires to have gsutil installed. You can force the path to gsutil +# by setting the GSUTIL environment variable +function build_and_publish_site() { + tmpdir=$(mktemp -d ${TMPDIR:-/tmp}/tmp.XXXXXXXX) + trap 'rm -fr ${tmpdir}' EXIT + local gs="$(get_gsutil)" + local site="$1" + local bucket="$2" + + if [ ! -f "${site}" ] || [ -z "${bucket}" ]; then + echo "Usage: build_and_publish_site <site-tarball> <bucket>" >&2 + return 1 + fi + tar xf "${site}" --exclude=CNAME -C "${tmpdir}" + jekyll build -s "${tmpdir}" -d "${tmpdir}/production" + "${gs}" rsync -r "${tmpdir}/production" "gs://${bucket}" + "${gs}" web set -m index.html -e 404.html "gs://${bucket}" + "${gs}" -m acl ch -R -u AllUsers:R "gs://${bucket}" +} |