Skip to content

Instantly share code, notes, and snippets.

@bryaneaton
Last active February 22, 2023 18:27
Show Gist options
  • Save bryaneaton/747c91eb2188a07ede5351edea77491d to your computer and use it in GitHub Desktop.
Save bryaneaton/747c91eb2188a07ede5351edea77491d to your computer and use it in GitHub Desktop.
Build Platform script
#!/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