Created
April 5, 2019 04:28
-
-
Save chriskuech/8b961b7110ba9b346e03fab8d8ff0ff4 to your computer and use it in GitHub Desktop.
Elastic Beanstalk NodeJS deployment script
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 | |
# ensure there are no uncommitted changes | |
git diff-index --quiet HEAD -- || { echo "Untracked changes" >&2; exit 1; } | |
# derive variables | |
branch="$(git symbolic-ref --short HEAD)" | |
timestamp="$(date +%Y%m%dT%H%M%S)" | |
# do work on a separate branch | |
git checkout -b "deploy/$timestamp" && | |
# build the app | |
yarn build && | |
# force checkin the build | |
git add ./.next --force && | |
git commit -am "Adding production build" && | |
# deploy the branch (uses git under the hood) | |
eb deploy "prod" && | |
echo "Deployment completed successfully" | |
# switch back to main branch | |
git checkout $branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment