beacon-node-builds: don't fetch if we're on a detached head
Causes failures when a tag is checked out, nothing to fetch. Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
33ba3b1e8b
commit
8e0966fb0e
|
@ -15,14 +15,24 @@ TAG="{{ item.name }}"
|
|||
pushd repo
|
||||
|
||||
COMMIT_BEFORE=$(git rev-parse --short=8 HEAD)
|
||||
# We cannot use "git pull" in here, because history may be changed upstream
|
||||
git fetch
|
||||
git reset --hard origin/{{ item.version }}
|
||||
SYMBOLIC_NAME=$(git rev-parse --abbrev-ref --symbolic-full-name HEAD)
|
||||
|
||||
function headIsDetached() { [[ "${SYMBOLIC_NAME}" == "HEAD" ]]; }
|
||||
|
||||
# Detached HEAD means we're probably on a tag
|
||||
if headIsDetached; then
|
||||
echo "Deatached HEAD, nothing to fetch."
|
||||
else
|
||||
# We cannot use "git pull" in here, because history may be changed upstream
|
||||
git fetch
|
||||
git reset --hard origin/{{ item.version }}
|
||||
fi
|
||||
|
||||
COMMIT_AFTER=$(git rev-parse --short=8 HEAD)
|
||||
|
||||
if [[ "$1" == "--force" ]]; then
|
||||
echo "Forcing rebuild!"
|
||||
elif [[ "${COMMIT_BEFORE}" == "${COMMIT_AFTER}" ]]; then
|
||||
elif ! headIsDetached && [[ "${COMMIT_BEFORE}" == "${COMMIT_AFTER}" ]]; then
|
||||
echo "Nothing new to build."
|
||||
exit
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue