forked from segmentio/segment-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload-docs
More file actions
executable file
·34 lines (26 loc) · 809 Bytes
/
upload-docs
File metadata and controls
executable file
·34 lines (26 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
set -euo pipefail
source "${SEGMENT_LIB_PATH}/aws.bash"
BRANCH="${BUILDKITE_BRANCH}"
echo "--- Branch ${BRANCH}"
# Use appropriate role to sync to S#
# Assign S3 Bucket and use the appropriate role to authenticate to S3
S3_BUCKET_NAME="segment-docs-stage"
role_arn="arn:aws:iam::355207333203:role/buildkite-agent"
if [ ${BRANCH} = 'master' ]
then
S3_BUCKET_NAME="segment-docs-prod"
role_arn="arn:aws:iam::752180062774:role/buildkite-agent"
fi
s3-sync() {
echo "--- Uploading to s3://${S3_BUCKET_NAME}/docs"
ls -a
aws s3 sync _site s3://${S3_BUCKET_NAME}/docs/ --delete
}
# Only Sync to S3 on Build step and for prod/staging environments
if [[ ${BRANCH} = 'master' || ${BRANCH} = 'staging' ]];
then
run-with-role "${role_arn}" s3-sync
fi
echo "--- Build Complete"
# vim: ft=sh