From 2295bbf69e16e70144c21e5ee52d853bb7cb4e4f 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, 20 Feb 2021 14:20:52 +0800 Subject: [PATCH] publish to `Open VSX` --- .gitignore | 1 + publish.lua | 53 ++++++++++++++++++++++++++++------------------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index f8678ba..aa7ec1d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /client/out/*.map /publish/ /luadoc/out/ +/ovsx-token diff --git a/publish.lua b/publish.lua index ab957ea..43960de 100644 --- a/publish.lua +++ b/publish.lua @@ -202,53 +202,56 @@ for i = 5, 0, -1 do thread.sleep(1) end +local function shell(command) + command.cwd = out + command.stdout = true + command.stderr = true + local p, err = subprocess.shell(command) + if not p then + error(err) + end + p:wait() + print(p.stdout:read 'a') + print(p.stderr:read 'a') +end + local vsix = ROOT / 'publish' / ('lua-' .. version .. '.vsix') -local p, err = subprocess.shell { +shell { 'vsce', 'package', '-o', vsix, - cwd = out, - stderr = true, } -if not p then - error(err) -end -p:wait() -print(p.stderr:read 'a') -local p =subprocess.shell { +shell { 'git', 'add', '*', } -p:wait() -local p = subprocess.shell { +shell { 'git', 'commit', '-m', tostring(version), } -p:wait() -local p = subprocess.shell { +shell { 'git', 'tag', 'v' .. tostring(version), } -p:wait() -local p = subprocess.shell { +shell { 'git', 'push', } -p:wait() -local p = subprocess.shell { +shell { 'git', 'push', '--tags', } -p:wait() -local p, err = subprocess.shell { +shell { 'vsce', 'publish', - cwd = out, - stderr = true, - stdout = true, } -if not p then - error(err) + +local ovsxToken = fsu.loadFile(ROOT / 'ovsx-token') +if ovsxToken then + ovsxToken = ovsxToken:match '[%w%-]+' + shell { + 'npx', 'ovsx', 'plublish', vsix, + '-p', ovsxToken + } end -p:wait() print('完成') -- GitLab