fix: check if deployment branch exists on remote; woodpecker only clones trigger branch

wip-coc
Aravinth Manivannan 2022-04-16 13:16:39 +05:30
parent 800bb5687c
commit 99b0d49f5c
Signed by untrusted user: realaravinth
GPG Key ID: AD9F0F08E855ED88
1 changed files with 3 additions and 3 deletions

View File

@ -98,12 +98,12 @@ deploy() {
tmp_dir=$(mktemp -d) tmp_dir=$(mktemp -d)
cp -r $2/* $tmp_dir cp -r $2/* $tmp_dir
if [[ -z $(git branch --list $1) ]] if [[ -z $(git ls-remote --heads origin ${1}) ]]
then then
"[*] Creating deployment branch $1" echo "[*] Creating deployment branch $1"
git checkout --orphan $1 git checkout --orphan $1
else else
"[*] Deployment branch $1 exists, pulling changes from remote" echo "[*] Deployment branch $1 exists, pulling changes from remote"
git pull origin $1 --force git pull origin $1 --force
git checkout $1 git checkout $1
fi fi