Last active
January 4, 2016 01:39
-
-
Save gbluma/8550264 to your computer and use it in GitHub Desktop.
A deploy script that can look at old versions of code in Git
This file contains hidden or 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 | |
function deploy() { | |
echo "Deploying tag: $1" | |
# create a working folder | |
mkdir -p "$DEPLOY_DIR/$1" | |
# dump code to this new folder | |
git archive $(cat .git/refs/tags/$1):src 2>/dev/null | \ | |
tar -x -C "$DEPLOY_DIR/$1" 2>/dev/null | |
} | |
set +e | |
DEPLOY_DIR=www | |
# clean up old stuff | |
rm -Rf "$DEPLOY_DIR/*" | |
deploy "HEAD" | |
for tag in $(git tag); do | |
deploy $tag | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment