1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-11-15 01:25:25 +01:00
portfolio/scripts/deploy.sh

44 lines
958 B
Bash
Raw Normal View History

2018-05-14 01:50:11 +02:00
#!/usr/bin/env bash
#
# required environment variables:
# AWS_ACCESS_KEY_ID
# AWS_SECRET_ACCESS_KEY
# AWS_DEFAULT_REGION
# AWS_S3_BUCKET
#
set -e;
##
## check for pull request against master
##
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
aws s3 sync \
2018-05-23 21:47:54 +02:00
--delete \
--acl public-read \
./public s3://"$AWS_S3_BUCKET_BETA"
2018-05-14 01:50:11 +02:00
##
## check for master push which is no pull request
##
elif [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] || [ "$TRAVIS" != true ]; then
aws s3 sync \
2018-05-23 21:47:54 +02:00
--delete \
--acl public-read \
./public s3://"$AWS_S3_BUCKET"
2018-05-14 01:50:11 +02:00
echo "---------------------------------------------"
echo " ✓ done deployment "
echo "---------------------------------------------"
exit;
else
echo "---------------------------------------------"
echo " nothing to deploy "
echo "---------------------------------------------"
fi