We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 56b5375 + 1abbb57 commit 47d8346Copy full SHA for 47d8346
scripts/publish.sh
@@ -25,6 +25,16 @@ git add dist --force
25
git commit -m "Added files generated by Travis build"
26
27
# Push to dist branch
28
-git push upstream $TRAVIS_BRANCH:$TRAVIS_BRANCH-dist --force -v
+EXISTING=`git ls-remote --heads https://github.com/"$TRAVIS_REPO_SLUG".git "$TRAVIS_BRANCH"-dist`
29
+
30
+if [ -n "$EXISTING" ]
31
+then
32
+ git fetch upstream $TRAVIS_BRANCH-dist:$TRAVIS_BRANCH-dist
33
+ git checkout $TRAVIS_BRANCH-dist
34
+ git merge -Xtheirs $TRAVIS_BRANCH --no-edit --ff
35
+ git push upstream $TRAVIS_BRANCH-dist --force -v
36
+else
37
+ git push upstream $TRAVIS_BRANCH:$TRAVIS_BRANCH-dist --force -v
38
+fi
39
40
exit $?
0 commit comments