Created
February 26, 2015 16:29
-
-
Save kamranayub/ca7b6866ab43771d9da8 to your computer and use it in GitHub Desktop.
Deploy site from Travis
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 | |
echo "Running deployment script..." | |
CURRENT_COMMIT=`git rev-parse HEAD` | |
# Change the branch used if applicable (e.g. gh-pages) | |
echo "Cloning master branch..." | |
# Hide output since we use an access token here | |
git clone -b master "https://${GH_TOKEN}@${GH_REF}" _deploy > /dev/null 2>&1 || exit 1 | |
### | |
# Copy your source files to a deployment directory | |
echo "Copying built files" | |
cp -r ./public/* _deploy | |
### | |
# Move into deployment directory | |
cd _deploy | |
echo "Committing and pushing to GH" | |
git config user.name "Travis-CI" | |
git config user.email "[email protected]" | |
# Commit changes, allowing empty changes (when unchanged) | |
git add -A | |
git commit --allow-empty -m "Deploying site for $CURRENT_COMMIT" || exit 1 | |
# Push to branch | |
git push origin master > /dev/null 2>&1 || exit 1 | |
echo "Pushed deployment successfully" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment