Explorar el Código

For Travis CI - use HEAD instead of $TRAVIS_BRANCH for ci_rebase task.
This is because the detached head may actually move due to API documentation update, so $TRAVIS_BRANCH environment variable may actually just point to HEAD~ in this scenario, which was not good as it would cause CI mirror branches became being pushed twice unnecessarily, one for HEAD~ and one for HEAD.
Using HEAD should work equally well for both normal commit and release tagging commit.

Yao Wei Tjong 姚伟忠 hace 11 años
padre
commit
1e195bb186
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      Rakefile

+ 3 - 2
Rakefile

@@ -124,7 +124,7 @@ task :ci_site_update do
   else
   else
     instruction = 'package'
     instruction = 'package'
   end
   end
-  # Supply GIT credentials and push API documentation to urho3d/Urho3D.git (the push may not be successful if detached HEAD is not a fast forward of remote master)
+  # Supply GIT credentials and push API documentation to urho3d/Urho3D.git (the push may not be successful if remote master has already diverged)
   system 'pwd && git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/$TRAVIS_REPO_SLUG.git && git add Docs/*API*'
   system 'pwd && git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/$TRAVIS_REPO_SLUG.git && git add Docs/*API*'
   if system("git commit -q -m 'Travis CI: API documentation update at #{Time.now.utc}.\n[ci #{instruction}]'") && !ENV['PACKAGE_UPLOAD']
   if system("git commit -q -m 'Travis CI: API documentation update at #{Time.now.utc}.\n[ci #{instruction}]'") && !ENV['PACKAGE_UPLOAD']
     bump_soversion 'Source/Engine/.soversion' or abort 'Failed to bump soversion'
     bump_soversion 'Source/Engine/.soversion' or abort 'Failed to bump soversion'
@@ -137,7 +137,8 @@ end
 desc 'Rebase all CI mirror branches'
 desc 'Rebase all CI mirror branches'
 task :ci_rebase do
 task :ci_rebase do
   system 'git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/$TRAVIS_REPO_SLUG.git'
   system 'git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/$TRAVIS_REPO_SLUG.git'
-  [ 'Android-CI', 'RPI-CI', 'OSX-CI' ].each { |branch| system "git fetch origin #{branch}:#{branch} && git rebase #{ENV['TRAVIS_BRANCH']} #{branch} && git push -qf -u origin #{branch} >/dev/null 2>&1" or abort "Failed to rebase #{branch} mirror branch" }
+  head = `git rev-parse --short HEAD`
+  [ 'Android-CI', 'RPI-CI', 'OSX-CI' ].each { |branch| system "git fetch origin #{branch}:#{branch} && git rebase HEAD #{branch} && git push -qf -u origin #{branch} >/dev/null 2>&1 && git checkout -q #{head}" or abort "Failed to rebase #{branch} mirror branch" }
 end
 end
 
 
 # Usage: NOT intended to be used manually (if you insist then try: rake ci_package_upload)
 # Usage: NOT intended to be used manually (if you insist then try: rake ci_package_upload)