1
1
import os
2
+ import subprocess
3
+ import sys
2
4
from pathlib import Path
3
- from subprocess import run
5
+ from typing import Any
4
6
5
7
from scripts .tools import get_version
6
8
7
9
10
+ def run (title : str , * args : Any , ** kwargs : Any ) -> None :
11
+ try :
12
+ print (f"running { title } " )
13
+ subprocess .run (* args , ** kwargs )
14
+ except (SystemExit , KeyboardInterrupt ):
15
+ raise
16
+ except BaseException as e :
17
+ print (f"{ title } failed: { e } " , file = sys .stderr )
18
+ pass
19
+
20
+
8
21
def main () -> None :
9
22
dist_path = Path ("./dist" )
10
23
@@ -15,14 +28,10 @@ def main() -> None:
15
28
16
29
vsix_path = Path (dist_path , f"robotcode-{ current_version } .vsix" )
17
30
18
- print ("publish to vscode marketplace..." )
19
- run (f"npx vsce publish -i { vsix_path } " , shell = True , timeout = 600 )
20
-
21
- print ("publish to openVSX..." )
22
- run (f"npx ovsx publish { vsix_path } " , shell = True , timeout = 600 )
23
-
24
- print ("publish to PyPi..." )
31
+ run ("npx vsce publish" , f"npx vsce publish -i { vsix_path } " , shell = True , timeout = 600 )
32
+ run ("npx ovsx publish" , f"npx ovsx publish { vsix_path } " , shell = True , timeout = 600 )
25
33
run (
34
+ "poetry publish" ,
26
35
f"poetry publish --username { os .environ ['PYPI_USERNAME' ]} --password { os .environ ['PYPI_PASSWORD' ]} " ,
27
36
shell = True ,
28
37
timeout = 600 ,
0 commit comments