From 7a155081f400ad2b53a9cdd3cd6c5cb731e13e3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= <sumneko@hotmail.com>
Date: Sat, 25 Jul 2020 17:13:01 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=85=88=E8=BF=99=E6=A0=B7?=
 =?UTF-8?q?=E5=90=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 publish.lua | 48 +++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 39 insertions(+), 9 deletions(-)

diff --git a/publish.lua b/publish.lua
index 24b457b..a305e18 100644
--- a/publish.lua
+++ b/publish.lua
@@ -4,13 +4,14 @@ if rootPath == '' then
     rootPath = './'
 end
 loadfile(rootPath .. 'server/platform.lua')('script')
+require 'bee'
 local fs = require 'bee.filesystem'
 local subprocess = require 'bee.subprocess'
 local platform = require 'bee.platform'
-
+local thread = require 'bee.thread'
 
 require 'utility'
-dofile(rootPath .. 'server/test.lua')
+--dofile(rootPath .. 'server/test.lua')
 
 package.path = package.path
     .. ';' .. rootPath .. '/?.lua'
@@ -187,12 +188,41 @@ removeFiles(out) {
     },
 }
 
-local path = ROOT / 'publish' / 'lua'
-print('清理发布目录...')
-removeFiles(path)(true)
+print('完成')
 
-print('复制到发布目录...')
-local count = copyFiles(out, path)(true)
-print(('复制了[%d]个文件'):format(count))
+for i = 5, 0, -1 do
+    print('将在' .. i .. '秒后发布版本:', version)
+    thread.sleep(1)
+end
 
-print('完成')
+local vsix = ROOT / 'publish' / ('lua-' .. version .. '.vsix')
+local p, err = subprocess.shell {
+    'vsce', 'package',
+    '-o', vsix,
+    cwd = out,
+    stderr = true,
+}
+if not p then
+    error(err)
+end
+p:wait()
+print(p.stderr:read 'a')
+
+subprocess.shell {
+    'git', 'tag', 'v' .. tostring(version),
+}
+
+subprocess.shell {
+    'git', 'push', '--tags',
+}
+
+local p, err = subprocess.shell {
+    'vsce', 'publish',
+    cwd = out,
+    stderr = true,
+}
+if not p then
+    error(err)
+end
+p:wait()
+print(p.stderr:read 'a')
-- 
GitLab