Browse Source

For Travis CI - simplify the ci_rebase rake task.
On normal commit, use the origin/master. On git tagging commit, use the 'tag' branch.
Also when on git taggig commit, prevent API doc update on the master branch because it is already too late to do so as the commit won't be in the tag anyway.

Yao Wei Tjong 姚伟忠 11 years ago
parent
commit
e0d13d706e
1 changed files with 10 additions and 8 deletions
  1. 10 8
      Rakefile

+ 10 - 8
Rakefile

@@ -125,21 +125,23 @@ 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 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*'
-  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'
-    system "git add Source/Engine/.soversion && git commit --amend -q -m 'Travis CI: API documentation update at #{Time.now.utc}.\n[ci #{instruction}]'" or abort 'Failed to stage .soversion file'
+  if !ENV['RELEASE_TAG']
+    # 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*'
+    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'
+      system "git add Source/Engine/.soversion && git commit --amend -q -m 'Travis CI: API documentation update at #{Time.now.utc}.\n[ci #{instruction}]'" or abort 'Failed to stage .soversion file'
+    end
+    system "git push origin HEAD:master -q >/dev/null 2>&1" or abort 'Failed to update API documentation, most likely due to remote master has diverged, the API documentation update will be performed again in the subsequent CI build'
   end
   end
-  system "git push origin HEAD:master -q >/dev/null 2>&1" or abort 'Failed to update API documentation, most likely due to remote master has diverged, the API documentation update will be performed again in the subsequent CI build'
 end
 end
 
 
 # Usage: NOT intended to be used manually (if you insist then try: GIT_NAME=... GIT_EMAIL=... GH_TOKEN=... rake ci_rebase)
 # Usage: NOT intended to be used manually (if you insist then try: GIT_NAME=... GIT_EMAIL=... GH_TOKEN=... rake ci_rebase)
 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'
-  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" }
+  baseline = ENV['RELEASE_TAG'] || "origin/#{ENV['TRAVIS_BRANCH']}"
+  [ 'Android-CI', 'RPI-CI', 'OSX-CI' ].each { |branch| system "git fetch origin #{branch}:#{branch} && git rebase #{baseline} #{branch} && git push -qf -u origin #{branch} >/dev/null 2>&1" 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)