Last active
February 22, 2023 18:27
-
-
Save bryaneaton/747c91eb2188a07ede5351edea77491d to your computer and use it in GitHub Desktop.
Build Platform script
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
#!/usr/bin/env bash | |
REGSCALE_DIR=/home/bryan/Sync/regscale/regscale | |
DOCKER_DIR=/home/bryan/Sync/regscale/standalone | |
cd $REGSCALE_DIR | |
REPO_STATUS="Unknown" | |
UPSTREAM=${1:-'@{u}'} | |
LOCAL=$(git rev-parse @) | |
REMOTE=$(git rev-parse "$UPSTREAM") | |
BASE=$(git merge-base @ "$UPSTREAM") | |
if [ $LOCAL = $REMOTE ]; then | |
REPO_STATUS="Up-to-date" | |
elif [ $LOCAL = $BASE ]; then | |
REPO_STATUS="Need to pull" | |
elif [ $REMOTE = $BASE ]; then | |
REPO_STATUS="Need to push" | |
else | |
REPO_STATUS="Diverged" | |
fi | |
echo $REPO_STATUS | |
if [[ $REPO_STATUS == "Need to pull" ]]; | |
then | |
git pull origin dev | |
docker build -t regscale/regscale:latest_dev . | |
cd $DOCKER_DIR | |
docker compose stop | |
docker compose rm -f | |
docker compose up -d | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment