File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -58,23 +58,22 @@ publishPackage() {
5858
5959 echo " Starting cloning process of ${repoUrl} into ${repoDir} .."
6060
61- # Clone the repository and only fetch the last commit to download less unused data.
62- git clone ${repoUrl} ${repoDir} --depth 1
61+ if [[ $( git ls-remote --heads ${repoUrl} ${branchName} ) ]]; then
62+ echo " Branch ${branchName} already exists. Cloning that branch."
63+ git clone ${repoUrl} ${repoDir} --depth 1 --branch ${branchName}
6364
64- echo " Successfully cloned ${repoUrl} into ${repoDir} ."
65+ cd ${repoDir}
66+ echo " Cloned repository and switched into the repository directory (${repoDir} )."
67+ else
68+ echo " Branch ${branchName} does not exist on ${packageRepo} yet."
69+ echo " Cloning default branch and creating branch '${branchName} ' on top of it."
6570
66- # Create the build commit and push the changes to the repository.
67- cd ${repoDir}
71+ git clone ${repoUrl} ${repoDir} --depth 1
72+ cd ${repoDir}
6873
69- echo " Switched into the repository directory ( ${repoDir} ) ."
74+ echo " Cloned repository and switched into directory. Creating new branch now. ."
7075
71- if [[ $( git ls-remote --heads origin ${branchName} ) ]]; then
72- git checkout ${branchName}
73- echo " Switched to ${branchName} branch."
74- else
75- echo " Branch ${branchName} does not exist on ${packageRepo} yet. Creating ${branchName} .."
7676 git checkout -b ${branchName}
77- echo " Branch created and checked out."
7877 fi
7978
8079 # Copy the build files to the repository
You can’t perform that action at this time.
0 commit comments