Browse Source

For Travis CI - automate housekeeping of old snapshots.
[ci package]

Yao Wei Tjong 姚伟忠 11 years ago
parent
commit
a6036755b9
1 changed files with 9 additions and 0 deletions
  1. 9 0
      Rakefile

+ 9 - 0
Rakefile

@@ -133,6 +133,15 @@ task :travis_ci_package_upload do
   # Determine the upload location
   if ENV['RELEASE_TAG'].empty?
     upload_dir = '/home/frs/project/urho3d/Urho3D/Snapshots'
+    # Only keep the snapshots from the last 30 revisions
+    if ENV['SITE_UPDATE']
+      system "for v in $(sftp [email protected] <<EOF |tr ' ' '\n' |grep Urho3D- |cut -d '-' -f1,2 |uniq |tail -n +31
+cd #{upload_dir}
+ls -1t
+bye
+EOF
+); do echo rm #{upload_dir}/${v}*; done |sftp -b - [email protected]" or abort 'Failed to housekeep snapshots'
+    end
   else
     upload_dir = "/home/frs/project/urho3d/Urho3D/#{ENV['RELEASE_TAG']}"
     # Make sure the release directory exists remotely