Skip to content

Commit 51f6cd4

Browse files
committed
fix: Fixes code that checks for the existence of remote branch.
1 parent f0105ae commit 51f6cd4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

post-build.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@ echo ">>>Running post-build.sh"
1818

1919
#!/bin/bash
2020

21-
# Create dist branch if it doesn't exist already
22-
if ! git show-ref --verify --quiet refs/heads/dist; then
23-
# Delete the dist branch locally
24-
git branch -D dist
21+
# Check if the dist branch exists remotely
22+
if git ls-remote --exit-code --heads origin dist; then
23+
# Delete the dist branch locally if it exists
24+
if git show-ref --verify --quiet refs/heads/dist; then
25+
git branch -D dist
26+
fi
2527
# Delete the dist branch remotely
2628
git push origin --delete dist
2729
fi
2830

29-
git checkout -b dist
31+
git checkout -b dist main
3032

3133
# Add and commit the changes to the dist folder
3234
git add dist

0 commit comments

Comments
 (0)