File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424[ -n " $AWS_DEFAULT_REGION " ] && export AWS_DEFAULT_REGION
2525
2626# Consider the most recent LastModified timestamp as the most recent version.
27- timestamps=$( aws s3api list-objects --bucket $bucket --prefix " $prefix " --query ' Contents[].{LastModified: LastModified}' )
28- recent=" $( echo $timestamps | jq -r ' max_by(.LastModified)' ) "
29- echo " [$recent ]"
27+ recent=" $( " $( dirname $0 ) /get_version.sh" " $bucket " " $prefix " ) "
28+ if [ -n " $recent " ]; then
29+ echo " [$recent ]"
30+ else
31+ echo " []"
32+ fi
Load diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Outputs the most recent version object: {"LastModified": "..."}
4+ # Prints nothing when no objects exist under the prefix.
5+
6+ set -e
7+
8+ bucket=$1
9+ prefix=$2
10+
11+ aws s3api list-objects \
12+ --bucket " $bucket " \
13+ --prefix " $prefix " \
14+ --query ' Contents[].{LastModified: LastModified}' \
15+ | jq -c ' if length == 0 then empty else max_by(.LastModified) end'
Original file line number Diff line number Diff line change @@ -41,4 +41,5 @@ if [ "$dosync" == "true" ]; then
4141 echo " ...done."
4242fi
4343
44- source " $( dirname $0 ) /emit.sh" >&3
44+ version=$( echo " $payload " | jq -c ' .version' )
45+ echo " {\" version\" : $version }" >&3
Original file line number Diff line number Diff line change @@ -42,4 +42,5 @@ echo "Running: aws s3 cp $source/$dir \"s3://$bucket/$path\" $options"
4242eval aws s3 cp $source /$dir " s3://$bucket /$path " $options $put_options
4343echo " ...done."
4444
45- source " $( dirname $0 ) /emit.sh" >&3
45+ recent=" $( " $( dirname $0 ) /get_version.sh" " $bucket " " $path " ) "
46+ echo " {\" version\" : $recent }" >&3
You can’t perform that action at this time.
0 commit comments