daml/ci/configure-bazel.sh
Gary Verhaegen 5ab5ced2e3 add GCS bucket for docs (#1062)
This is a first step towards improving our docs release process. The
goal here is to get rid of the manual "publish docs" step. This is done
as a periodic check because we only want to run this for "published"
releases, i.e. the ones that are not marked as prerelease. Because the
act of publishing a release is a manual step that Azure cannot trigger
on, we instead opt for a periodic check.

Not included in this piece of work:
- Any change to the docs themselves; the goal here is to automate the
current process as a first step. Future plans for the docs themselves
include adding links to older versions of the docs.
- A better way to detect docs are already up-to-date, and abort if so.
- Including older versions of the docs.
- Switching the DNS record from the current AWS S3 bucket to this new
GCS bucket. That will be a manual step once we're happy with how the
new bucket works.
2019-05-11 03:27:17 +00:00

57 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
cd "$(dirname "$0")/.."
## Functions
step() {
echo "step: $*" >&2
}
is_windows() {
[[ $os = windows ]]
}
## Main
# always run in the project root
cd "$(dirname "$0")/.."
# detect the OS
case $(uname) in
Linux)
os=linux
;;
Darwin)
os=darwin
;;
MINGW*)
os=windows
;;
*)
echo "unknown kernel: $(uname)"
exit 1
;;
esac
cd "$(dirname "$0")"/..
step "configuring bazel"
if is_windows; then
echo "build --config windows" > .bazelrc.local
echo "build --config windows-ci" >> .bazelrc.local
fi
# sets up write access to the shared remote cache if the branch is not a fork
if [[ "${IS_FORK}" = False ]]; then
step "configuring write access to the remote cache"
GOOGLE_APPLICATION_CREDENTIALS=$(mktemp .tmp.XXXXXXXXXX)
echo "$GOOGLE_APPLICATION_CREDENTIALS_CONTENT" > "$GOOGLE_APPLICATION_CREDENTIALS"
unset GOOGLE_APPLICATION_CREDENTIALS_CONTENT
export GOOGLE_APPLICATION_CREDENTIALS
echo "build --remote_http_cache=https://storage.googleapis.com/daml-bazel-cache --remote_upload_local_results=true --google_credentials=${GOOGLE_APPLICATION_CREDENTIALS}" >> .bazelrc.local
fi