16 lines
406 B
Bash
Executable file
16 lines
406 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
source "$(dirname $0)/common.sh"
|
|
|
|
payload=`cat`
|
|
bucket=$(get_bucket)
|
|
prefix=$(get_prefix)
|
|
|
|
export_aws_vars
|
|
|
|
# Consider the most recent LastModified timestamp as the most recent version.
|
|
timestamps=$(aws s3api list-objects --bucket $bucket --prefix "$prefix" --query 'Contents[].{LastModified: LastModified}')
|
|
recent="$(echo $timestamps | jq -r 'max_by(.LastModified)')"
|
|
echo "[$recent]"
|