buildscript { repositories { mavenCentral() maven { url('https://dl.bintray.com/jetbrains/plugin-repository-rest-client/') } } dependencies { classpath 'org.jetbrains.intellij:plugin-repository-rest-client:0.1.15' } } task uploadPlugins() << { def env = System.getenv() def username = env['PLUGIN_REPOSITORY_USER'] def password = env['PLUGIN_REPOSITORY_PASSWORD'] def channel = env['PLUGIN_REPOSITORY_CHANNEL'] if (channel == "_default_") { channel = null } def path = env['PLUGIN_UPLOAD_PATH'] if (path == null) { path = "." } def repo = new org.jetbrains.intellij.pluginRepository.PluginRepositoryInstance( "https://plugins.jetbrains.com/", username, password) File[] files = new File(path).listFiles({ File f, String filename -> filename.startsWith("kotlin-plugin") && filename.endsWith(".zip") } as FilenameFilter) files = files.sort { f1, f2 -> f1.name.contains("1.1.2-5") ? 1 : (f2.name.contains("1.1.2-5") ? -1 : (f1.name <=> f2.name)) } files.each { file -> println("Uploading ${file.name}") repo.uploadPlugin(6954, file, channel) } } defaultTasks 'uploadPlugins'