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() {
58
58
59
59
echo " Starting cloning process of ${repoUrl} into ${repoDir} .."
60
60
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}
63
64
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."
65
70
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}
68
73
69
- echo " Switched into the repository directory ( ${repoDir} ) ."
74
+ echo " Cloned repository and switched into directory. Creating new branch now. ."
70
75
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} .."
76
76
git checkout -b ${branchName}
77
- echo " Branch created and checked out."
78
77
fi
79
78
80
79
# Copy the build files to the repository
You can’t perform that action at this time.
0 commit comments