Skip to content

Commit 2295bbf

Browse files
committed
publish to Open VSX
1 parent 11d9bbc commit 2295bbf

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/client/out/*.map
33
/publish/
44
/luadoc/out/
5+
/ovsx-token

publish.lua

+28-25
Original file line numberDiff line numberDiff line change
@@ -202,53 +202,56 @@ for i = 5, 0, -1 do
202202
thread.sleep(1)
203203
end
204204

205+
local function shell(command)
206+
command.cwd = out
207+
command.stdout = true
208+
command.stderr = true
209+
local p, err = subprocess.shell(command)
210+
if not p then
211+
error(err)
212+
end
213+
p:wait()
214+
print(p.stdout:read 'a')
215+
print(p.stderr:read 'a')
216+
end
217+
205218
local vsix = ROOT / 'publish' / ('lua-' .. version .. '.vsix')
206-
local p, err = subprocess.shell {
219+
shell {
207220
'vsce', 'package',
208221
'-o', vsix,
209-
cwd = out,
210-
stderr = true,
211222
}
212-
if not p then
213-
error(err)
214-
end
215-
p:wait()
216-
print(p.stderr:read 'a')
217223

218-
local p =subprocess.shell {
224+
shell {
219225
'git', 'add', '*',
220226
}
221-
p:wait()
222227

223-
local p = subprocess.shell {
228+
shell {
224229
'git', 'commit', '-m', tostring(version),
225230
}
226-
p:wait()
227231

228-
local p = subprocess.shell {
232+
shell {
229233
'git', 'tag', 'v' .. tostring(version),
230234
}
231-
p:wait()
232235

233-
local p = subprocess.shell {
236+
shell {
234237
'git', 'push',
235238
}
236-
p:wait()
237239

238-
local p = subprocess.shell {
240+
shell {
239241
'git', 'push', '--tags',
240242
}
241-
p:wait()
242243

243-
local p, err = subprocess.shell {
244+
shell {
244245
'vsce', 'publish',
245-
cwd = out,
246-
stderr = true,
247-
stdout = true,
248246
}
249-
if not p then
250-
error(err)
247+
248+
local ovsxToken = fsu.loadFile(ROOT / 'ovsx-token')
249+
if ovsxToken then
250+
ovsxToken = ovsxToken:match '[%w%-]+'
251+
shell {
252+
'npx', 'ovsx', 'plublish', vsix,
253+
'-p', ovsxToken
254+
}
251255
end
252-
p:wait()
253256

254257
print('完成')

0 commit comments

Comments
 (0)