From 9b59dcded9355ce4d0f7de7677667480b27c2ff6 Mon Sep 17 00:00:00 2001 From: Christopher Hoskin Date: Mon, 2 Dec 2019 12:17:23 +0000 Subject: [PATCH] Merge pull request #2420 from overleaf/csh-issue-2504-cdn-upload Script for CDN upload GitOrigin-RevId: f90a3b07178d8a231a2a7babac52bed3577065c1 --- services/web/bin/cdn_upload | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 services/web/bin/cdn_upload diff --git a/services/web/bin/cdn_upload b/services/web/bin/cdn_upload new file mode 100755 index 0000000000..c3e82a4217 --- /dev/null +++ b/services/web/bin/cdn_upload @@ -0,0 +1,14 @@ +#!/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/ -xzf build.tar.gz ./public/ + 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 + +