File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash -e
2+
3+ # check if aws is installed
4+ if [[ ! -n ` which aws` ]]; then
5+ echo " Error: Please install and configure 'aws'."
6+ exit 1
7+ fi
8+
9+ # get plotly.js version from its package json
10+ version=$( node -e " console.log(require('./package.json').version);" )
11+ major=$( node -e " console.log(require('./package.json').version.split('.')[0]);" )
12+
13+ # read tag either latest or rc
14+ tag=$( node -e " var rc = require('./package.json').version.split('-')[1]; console.log(rc ? rc.split('.')[0] : 'latest');" )
15+ # if not v1 add major version to the tag e.g. latest-v2
16+ if [ $major -ne 1 ]; then tag=$tag -v$major ; fi
17+ echo $tag
18+
19+ dist=dist
20+ sync=build/sync
21+
22+ # clear and make a sync folder
23+ if [ -d " $sync " ]; then rm -rf $sync ; fi
24+ mkdir -p $sync
25+
26+ # copy dist bundles over to the sync folder and rename them
27+ for path in ` ls $dist /plotly* ` ; do
28+ basename=${path##*/ }
29+ name=${basename%% .* }
30+ ext=" ${basename#* .} "
31+
32+ if [ $name == ' plotly-geo-assets' ] || [ $name == ' plotly-with-meta' ]; then
33+ continue
34+ fi
35+
36+ cp $path " $sync /${name} -${version} .$ext "
37+ cp $path " $sync /${name} -${tag} .$ext "
38+ done
39+
40+ # copy topojson files over to the sync folder
41+ cp $dist /topojson/* $sync
42+
43+ # list folder and files
44+ echo $sync
45+ ls $sync
46+
47+ # sync to s3
48+ aws s3 sync $sync / s3://plotly-cdn/ --acl public-read
You can’t perform that action at this time.
0 commit comments