diff --git a/Rakefile b/Rakefile index 7fb18c0ed65a7..0867c2c1de1cb 100644 --- a/Rakefile +++ b/Rakefile @@ -62,6 +62,12 @@ def dotnet_version end end +def python_version + File.foreach('py/BUILD.bazel') do |line| + return line.split('=').last.strip.tr('"', '') if line.include?('SE_VERSION') + end +end + # The build system used by webdriver is layered on top of rake, and we call it # "crazy fun" for no readily apparent reason. @@ -423,6 +429,17 @@ task :prepare_release do Bazel::execute('build', ['--stamp'], '//rb:selenium-webdriver') end +PYPI_ASSETS = [ + "bazel-bin/py/selenium-#{python_version}-py3-none-any.whl", + "bazel-bin/py/selenium-#{python_version}.tar.gz" +] + +task 'publish-pypi' do + PYPI_ASSETS.each do |asset| + sh "python3 -m twine upload #{asset}" + end +end + task 'publish-maven': JAVA_RELEASE_TARGETS do creds = read_m2_user_pass JAVA_RELEASE_TARGETS.each do |p|