Last active
August 29, 2015 14:21
-
-
Save sdbondi/ef5b55ee52fd52b62edc to your computer and use it in GitHub Desktop.
Codeship deploy script for elasticbeanstalk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
echo "---> Installing aws cli (if neccessary)" | |
type aws 1>/dev/null 2>&1 || pip install awscli | |
echo "---> Packaging app" | |
zip -r -x .git/\* tmp/\* .bundle/\* -v app-latest.zip $1 | |
APP_VERSION=app-`date +%Y%m%d%H%M%S` | |
echo "---> Pushing ${APP_VERSION}.zip to s3" | |
aws s3 mv app-latest.zip s3://$BUCKET/${APP_VERSION}.zip | |
echo "---> Creating EB application version" | |
aws elasticbeanstalk create-application-version \ | |
--application-name $EB_APP_NAME \ | |
--version-label $APP_VERSION \ | |
--source-bundle S3Bucket=${BUCKET%%/*},S3Key=${BUCKET#*/}/${APP_VERSION}.zip | |
sleep 20 | |
echo "---> Deploying revision to environment" | |
aws elasticbeanstalk update-environment \ | |
--environment-name $EB_ENVIRONMENT_NAME \ | |
--version-label $APP_VERSION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment