overleaf/services/web/bin/cdn_upload
Jakob Ackermann 48b138f227 Merge pull request #2929 from overleaf/jpa-ci-3m30s-with-custom-cloudbuild
[misc] another batch of CI improvements

GitOrigin-RevId: 470fd762ba541d5dce92f0e99830fb2fd8fc4747
2020-07-03 02:04:13 +00:00

18 lines
551 B
Bash
Executable file

#!/bin/bash
set -e
# Upload to staging CDN if branch is either 'master' or 'staging-master'
if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "staging-master" ]]; then
tar --directory=/tmp/ -xf build.tar
# delete source maps
find /tmp/public -name '*.js.map' -delete
gsutil -h "Cache-Control:public, max-age=31536000" -m cp -r /tmp/public $CDN_STAG
# Only upload to production CDN if branch is
if [[ "$BRANCH_NAME" == "master" ]]; then
gsutil -h "Cache-Control:public, max-age=31536000" -m cp -r /tmp/public $CDN_PROD
fi
fi