-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint.sh
executable file
·43 lines (35 loc) · 977 Bytes
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
set -e
if [ -z "$AWS_S3_BUCKET" ]; then
echo "AWS_S3_BUCKET is not set. Quitting."
exit 1
fi
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
echo "AWS_ACCESS_KEY_ID is not set. Quitting."
exit 1
fi
if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
echo "AWS_SECRET_ACCESS_KEY is not set. Quitting."
exit 1
fi
if [ -z "$AWS_REGION" ]; then
echo "AWS_REGION is not set. Quitting."
exit 1
fi
# Default to syncing entire repo if DEST_DIR not set.
if [ -z "$DEST_DIR" ]; then
DEST_DIR="."
fi
# Create a dedicated profile for this action to avoid
# conflicts with other actions.
# https://github.com/jakejarvis/s3-sync-action/issues/1
aws configure --profile s3-download-action <<-EOF > /dev/null 2>&1
${AWS_ACCESS_KEY_ID}
${AWS_SECRET_ACCESS_KEY}
${AWS_REGION}
text
EOF
# Use our dedicated profile and suppress verbose messages.
# All other flags are optional via `args:` directive.
sh -c "aws s3 cp s3://${AWS_S3_BUCKET} ${DEST_DIR} \
--recursive $*"