Bläddra i källkod

Update build_artifacts.lua

ruki 4 år sedan
förälder
incheckning
b426ed83bf
1 ändrade filer med 17 tillägg och 9 borttagningar
  1. 17 9
      scripts/build_artifacts.lua

+ 17 - 9
scripts/build_artifacts.lua

@@ -9,15 +9,23 @@ function build_artifacts(name, versions)
     local oldir = os.cd("build-artifacts")
     local oldir = os.cd("build-artifacts")
     local trycount = 0
     local trycount = 0
     while trycount < 2 do
     while trycount < 2 do
-        local ok = try { function ()
-            os.exec("git reset --hard HEAD^")
-            os.exec("git pull origin build")
-            io.save("build.txt", buildinfo)
-            os.exec("git add -A")
-            os.exec("git commit -a -m \"autobuild %s by xmake-repo/ci\"", name)
-            os.exec("git push origin build")
-            return true
-        end }
+        local ok = try
+        {
+            function ()
+                io.save("build.txt", buildinfo)
+                os.exec("git add -A")
+                os.exec("git commit -a -m \"autobuild %s by xmake-repo/ci\"", name)
+                os.exec("git push origin build")
+                return true
+            end,
+            catch
+            {
+                function ()
+                    os.exec("git reset --hard HEAD^")
+                    os.exec("git pull origin build")
+                end
+            }
+        }
         if ok then
         if ok then
             break
             break
         end
         end