@@ -5,6 +5,8 @@ import com.github.jk1.license.render.JsonReportRenderer
5
5
import com.jetbrains.plugin.structure.toolbox.ToolboxMeta
6
6
import com.jetbrains.plugin.structure.toolbox.ToolboxPluginDescriptor
7
7
import org.jetbrains.intellij.pluginRepository.PluginRepositoryFactory
8
+ import org.jetbrains.intellij.pluginRepository.model.LicenseUrl
9
+ import org.jetbrains.intellij.pluginRepository.model.ProductFamily
8
10
import org.jetbrains.kotlin.com.intellij.openapi.util.SystemInfoRt
9
11
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
10
12
import java.nio.file.Path
@@ -187,20 +189,43 @@ private fun getPluginInstallDir(): Path {
187
189
return pluginsDir / extension.id
188
190
}
189
191
190
- val publishPlugin by tasks.creating {
192
+ val publishPlugin by tasks.registering {
191
193
dependsOn(pluginZip)
192
194
193
195
doLast {
196
+ val pluginMarketplaceToken: String = if (System .getenv(" JETBRAINS_MARKETPLACE_PUBLISH_TOKEN" ).isNullOrBlank()) {
197
+ error(" Env. variable `JETBRAINS_MARKETPLACE_PUBLISH_TOKEN` does not exist. Please set the env. variable to a token obtained from the marketplace." )
198
+ } else {
199
+ System .getenv(" JETBRAINS_MARKETPLACE_PUBLISH_TOKEN" )
200
+ }
201
+
202
+ println (" Plugin Marketplace Token: ${pluginMarketplaceToken.take(5 )} *****" )
203
+
194
204
val instance = PluginRepositoryFactory .create(
195
205
" https://plugins.jetbrains.com" ,
196
- project.property( " PUBLISH_TOKEN " ).toString()
206
+ pluginMarketplaceToken
197
207
)
198
208
199
- // first upload
200
- // instance.uploader.uploadNewPlugin(pluginZip.outputs.files.singleFile, listOf("toolbox", "gateway"), LicenseUrl.APACHE_2_0, ProductFamily.TOOLBOX)
201
-
202
- // subsequent updates
203
- instance.uploader.upload(extension.id, pluginZip.outputs.files.singleFile)
209
+ if (extension.version == " 0.1.0" ) {
210
+ instance.uploader.uploadNewPlugin(
211
+ pluginZip.outputs.files.singleFile,
212
+ listOf (" toolbox" , " gateway" ), // do not change
213
+ LicenseUrl .MIT , // choose wisely
214
+ ProductFamily .TOOLBOX , // do not change
215
+ extension.meta.vendor, // do not change
216
+ isHidden = true
217
+ )
218
+ } else {
219
+ // !!! subsequent updates !!!
220
+ instance.uploader.uploadUpdateByXmlIdAndFamily(
221
+ extension.id, // do not change
222
+ ProductFamily .TOOLBOX , // do not change
223
+ pluginZip.outputs.files.singleFile, // do not change
224
+ null , // do not change. Channels will be available later
225
+ " Bug fixes and improvements" ,
226
+ true
227
+ )
228
+ }
204
229
}
205
230
}
206
231
0 commit comments