11import json
22import os
3+ import subprocess
34
45import http .client
56
7+
68def register_plugin_version (supertokens_api_key , plugin_version , plugin_interface_array , plugin_name ):
79 print ("Plugin Version: " , plugin_version )
810 print ("Plugin Interface Array: " , plugin_interface_array )
@@ -28,6 +30,7 @@ def register_plugin_version(supertokens_api_key, plugin_version, plugin_interfac
2830
2931 if response .status != 200 :
3032 print (f"failed plugin PUT API status code: { response .status } . Exiting!" )
33+ print (f"response: { str (response .read ())} " )
3134 exit (1 )
3235
3336 conn .close ()
@@ -44,6 +47,19 @@ def read_plugin_version():
4447with open ('pluginInterfaceSupported.json' , 'r' ) as fd :
4548 plugin_interface_array = json .load (fd )['versions' ]
4649
50+ def check_if_tag_exists (tag ):
51+ try :
52+ result = subprocess .run (['git' , 'tag' , '-l' , tag ], capture_output = True , text = True )
53+ return tag in result .stdout
54+ except subprocess .CalledProcessError :
55+ print (f"Error checking for tag { tag } " )
56+ return False
57+
58+ dev_tag = f"dev-v{ plugin_version } "
59+ if not check_if_tag_exists (dev_tag ):
60+ print (f"Tag { dev_tag } does not exist. Exiting!" )
61+ exit (0 )
62+
4763register_plugin_version (
4864 supertokens_api_key = os .environ .get ("SUPERTOKENS_API_KEY" ),
4965 plugin_version = plugin_version ,
0 commit comments