Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit b489e4d

Browse files
committed
update deploy.sh script
* add parameters for site and asset bucket * fix asset stage parameter when used with optional parameters * pin tag versions before setting "latest" * add echo for what assets have pinned versions * root level deploy only for untagged builds (e.g. test)
1 parent e6fbe6e commit b489e4d

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

_scripts/deploy.sh

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ set -e
55
bash _scripts/make-dist.sh
66
mkdocs build
77

8+
SITE_BUCKET=s3://docs.opendata.aws/genomics-workflows
89
ASSET_BUCKET=s3://aws-genomics-workflows
9-
ASSET_STAGE=${1:-production}
10+
ASSET_STAGE=test
1011

1112
PARAMS=""
1213
while (( "$#" )); do
1314
case "$1" in
14-
--bucket)
15+
--site-bucket)
16+
SITE_BUCKET=$2
17+
shift 2
18+
;;
19+
--asset-bucket)
1520
ASSET_BUCKET=$2
1621
shift 2
1722
;;
@@ -32,6 +37,8 @@ done
3237

3338
eval set -- "$PARAMS"
3439

40+
ASSET_STAGE=${1:-$ASSET_STAGE}
41+
3542
function s3_uri() {
3643
BUCKET=$1
3744
shift
@@ -65,14 +72,12 @@ function publish() {
6572
local source=$1
6673
local destination=$2
6774

68-
# root level is always "latest"
69-
S3_URI=$(s3_uri $ASSET_BUCKET $ASSET_STAGE_PATH $destination)
70-
71-
s3_sync $source $S3_URI
72-
7375
if [[ $USE_RELEASE_TAG && ! -z "$TRAVIS_TAG" ]]; then
7476
# create explicit pinned versions "latest" and TRAVIS_TAG
75-
for version in latest $TRAVIS_TAG; do
77+
# pin the TRAVIS_TAG first, since the files are modified inplace
78+
# "latest" will inherit the TRAVIS_TAG value
79+
echo "PINNED VERSION: $TRAVIS_TAG"
80+
for version in $TRAVIS_TAG latest; do
7681
S3_URI=$(s3_uri $ASSET_BUCKET $ASSET_STAGE_PATH $version $destination)
7782

7883
if [[ "$destination" == "templates" ]]; then
@@ -83,6 +88,10 @@ function publish() {
8388

8489
s3_sync $source $S3_URI
8590
done
91+
else
92+
# root level deploy, this only happens with stage=test (non-tagged builds)
93+
S3_URI=$(s3_uri $ASSET_BUCKET $ASSET_STAGE_PATH $destination)
94+
s3_sync $source $S3_URI
8695
fi
8796

8897
}
@@ -96,7 +105,9 @@ function pin_version() {
96105
local asset=$2
97106
local folder=$3
98107

108+
echo "PINNING VERSIONS"
99109
for file in `grep -irl "$asset # dist: pin_version" $folder`; do
110+
echo "pinning '$asset' as '$version/$asset' in '$file'"
100111
sed -i '' -e "s|$asset # dist: pin_version|$version/$asset #|g" $file
101112
done
102113
}
@@ -124,7 +135,7 @@ function site() {
124135
--delete \
125136
--metadata commit=$(git rev-parse HEAD) \
126137
./site \
127-
s3://docs.opendata.aws/genomics-workflows
138+
$SITE_BUCKET
128139
}
129140

130141

0 commit comments

Comments
 (0)