Created
November 27, 2014 23:17
-
-
Save cilf/994c27c9e2ddd3348b9a to your computer and use it in GitHub Desktop.
vps git deploy hook
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/sh | |
#and don't forget to make this file executable chmod +x post-receive | |
# set up | |
GIT_REPO=~/prod.git | |
PROJECT_DIR=~/prod | |
WILDFLY_HOME=/opt/wildfly | |
USER="admin" | |
PASSWORD="***" | |
echo "Pulling changes..." | |
GIT_WORK_TREE=$PROJECT_DIR git checkout -f | |
echo "Creating version.jsp..." | |
MESSAGE=$(cd $GIT_REPO && git log -1 HEAD) | |
echo $MESSAGE | tee $PROJECT_DIR/src/main/webapp/version.jsp | |
echo "Building..." | |
cd $PROJECT_DIR && mvn clean package -P prod -DskipTests | |
echo "Deploying..." | |
$WILDFLY_HOME/bin/jboss-cli.sh --user=$USER --password=$PASSWORD --connect --command="undeploy ROOT.war" | |
$WILDFLY_HOME/bin/jboss-cli.sh --user=$USER --password=$PASSWORD --connect --command="deploy --force target/ROOT.war" | |
echo "Aaaaaand we're done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment