-
-
Save wilcorrea/91b5ef56ed068a795adc9e9b42bd8354 to your computer and use it in GitHub Desktop.
build/release.sh
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 | |
# get script dir | |
if [ -L $0 ]; then | |
BASEDIR=$(dirname $(readlink $0)) | |
else | |
BASEDIR="$(cd "$(dirname "$0")" && pwd -P)" | |
fi | |
DIR="$BASEDIR/../dist" | |
# If an argument was passed | |
if [ "$1" != "" ]; then | |
if [ -d $1 ]; then | |
DIR=$1 | |
else | |
echo "ERROR: $1 not is a valid folder" | |
exit 1 | |
fi | |
fi | |
cd $DIR | |
BRANCH="release" | |
# If an second argument was passed | |
if [ "$2" != "" ]; then | |
REPO=$2 | |
fi | |
if [ "$3" != "" ]; then | |
BRANCH=$3 | |
fi | |
if [ "$REPO" == "" ]; then | |
REPO="$(cd .. && git remote get-url origin && cd $DIR)" | |
fi | |
echo "" | |
echo "DIR: $DIR" | |
echo "REPO: $REPO master:$BRANCH" | |
echo "" | |
# release script | |
MESSAGE="release: $(date) // $(whoami)@$(hostname)" | |
rm -rf .git | |
git init | |
git add -A | |
git commit -m "$MESSAGE" | |
git push -f $REPO master:$BRANCH | |
rm -rf .git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment