mirror of https://github.com/tidwall/tile38.git
wip - rename workflow file
This commit is contained in:
parent
6f65a5df1e
commit
773bef0658
|
@ -3,22 +3,6 @@
|
||||||
set -e
|
set -e
|
||||||
cd $(dirname "${BASH_SOURCE[0]}")/..
|
cd $(dirname "${BASH_SOURCE[0]}")/..
|
||||||
|
|
||||||
|
|
||||||
if [ "$DOCKER_USER" == "" ]; then
|
|
||||||
echo "Not pushing, DOCKER_USER not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$DOCKER_LOGIN" == "" ]; then
|
|
||||||
echo "Not pushing, DOCKER_LOGIN not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$DOCKER_PASSWORD" == "" ]; then
|
|
||||||
echo "Not pushing, DOCKER_PASSWORD not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# GIT_BRANCH is the current branch name
|
# GIT_BRANCH is the current branch name
|
||||||
export GIT_BRANCH=$(git branch --show-current)
|
export GIT_BRANCH=$(git branch --show-current)
|
||||||
# GIT_VERSION - always the last verison number, like 1.12.1.
|
# GIT_VERSION - always the last verison number, like 1.12.1.
|
||||||
|
@ -29,24 +13,30 @@ export GIT_COMMIT_SHORT=$(git rev-parse --short HEAD)
|
||||||
export DOCKER_REPO=$DOCKER_USER/tile38
|
export DOCKER_REPO=$DOCKER_USER/tile38
|
||||||
|
|
||||||
if [ "$GIT_BRANCH" != "master" ]; then
|
if [ "$GIT_BRANCH" != "master" ]; then
|
||||||
# only the master branch will work
|
|
||||||
echo "Not pushing, not on master"
|
echo "Not pushing, not on master"
|
||||||
|
elif [ "$DOCKER_USER" == "" ]; then
|
||||||
|
echo "Not pushing, DOCKER_USER not set"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
elif [ "$DOCKER_LOGIN" == "" ]; then
|
||||||
|
echo "Not pushing, DOCKER_LOGIN not set"
|
||||||
push(){
|
exit 1
|
||||||
docker tag $DOCKER_REPO:$GIT_COMMIT_SHORT $DOCKER_REPO:$1
|
elif [ "$DOCKER_PASSWORD" == "" ]; then
|
||||||
docker push $DOCKER_REPO:$1
|
echo "Not pushing, DOCKER_PASSWORD not set"
|
||||||
echo "Pushed $DOCKER_REPO:$1"
|
exit 1
|
||||||
}
|
else
|
||||||
|
push(){
|
||||||
# docker login
|
docker tag $DOCKER_REPO:$GIT_COMMIT_SHORT $DOCKER_REPO:$1
|
||||||
echo $DOCKER_PASSWORD | docker login -u $DOCKER_LOGIN --password-stdin
|
docker push $DOCKER_REPO:$1
|
||||||
# build the docker image
|
echo "Pushed $DOCKER_REPO:$1"
|
||||||
docker build -f Dockerfile -t $DOCKER_REPO:$GIT_COMMIT_SHORT .
|
}
|
||||||
if [ "$(curl -s https://hub.docker.com/v2/repositories/$DOCKER_REPO/tags/$GIT_VERSION/ | grep "digest")" == "" ]; then
|
# docker login
|
||||||
# push the newest tag
|
echo $DOCKER_PASSWORD | docker login -u $DOCKER_LOGIN --password-stdin
|
||||||
push "$GIT_VERSION"
|
# build the docker image
|
||||||
push "latest"
|
docker build -f Dockerfile -t $DOCKER_REPO:$GIT_COMMIT_SHORT .
|
||||||
fi
|
if [ "$(curl -s https://hub.docker.com/v2/repositories/$DOCKER_REPO/tags/$GIT_VERSION/ | grep "digest")" == "" ]; then
|
||||||
push "edge"
|
# push the newest tag
|
||||||
|
push "$GIT_VERSION"
|
||||||
|
push "latest"
|
||||||
|
fi
|
||||||
|
push "edge"
|
||||||
|
fi
|
Loading…
Reference in New Issue