1
1
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2
+ import de.dosmike.sponge.pluginpublisher.gradle.NotifyDiscordBotTask
3
+ import de.dosmike.sponge.pluginpublisher.gradle.PublishToGitTask
4
+ import de.dosmike.sponge.pluginpublisher.gradle.PublishToOreTask
2
5
import de.dosmike.sponge.pluginpublisher.tasks.DiscordBotConfiguration
3
6
import de.dosmike.sponge.pluginpublisher.tasks.GitConfiguration
4
7
import de.dosmike.sponge.pluginpublisher.tasks.OreConfiguration
@@ -10,7 +13,7 @@ plugins {
10
13
id ' idea'
11
14
id ' org.spongepowered.plugin' version ' 0.9.0'
12
15
id ' com.github.johnrengelman.shadow' version ' 5.1.0'
13
- id ' com.github.dosmike.PluginPublisher' version ' 1.2.1 '
16
+ id ' com.github.dosmike.PluginPublisher' version ' 1.2.2 '
14
17
}
15
18
group = ' com.github.dosmike'
16
19
@@ -130,50 +133,49 @@ task zReleaseZip(type: Zip, group:'_Plugin', dependsOn: uberJar) {
130
133
into ' mods'
131
134
}
132
135
}
133
-
134
- task zPublish (group :' _Plugin' , dependsOn :zReleaseZip) {
136
+ task z_Publish (group :' _Plugin' , dependsOn :zReleaseZip) {
135
137
def keyfile = file(' ..\\ PluginPublisher\\ .apikeys' )
136
138
onlyIf { keyfile. exists() }
139
+ outputs. upToDateWhen {false }
137
140
def props, versionDesc
138
141
doFirst {
139
142
props = new Properties ()
140
143
file(' ..\\ PluginPublisher\\ .apikeys' ). withInputStream {
141
144
props. load(it)
142
145
}
143
146
// show an input prompt
144
- versionDesc = TaskFunctors . validateReleaseDescription(null , false );
145
- }
146
- doLast {
147
- TaskFunctors . runGitTask(new GitConfiguration (
148
- apiKey : props. getProperty(' gitkey' ),
149
- slug : ' DosMike/VillagerShops' ,
150
- tag : version,
151
- tagFull : " Release Build ${ version} " ,
152
- assets : zReleaseZip. outputs. files,
153
- description : versionDesc
154
- ), { -> files(it). files } )
147
+ versionDesc = TaskFunctors . validateReleaseDescription(null , false )
155
148
}
156
-
157
149
doLast {
158
- TaskFunctors . runOreTask(new OreConfiguration (
159
- apiKey : props. getProperty(' orekey' ),
160
- project : ' DosMike/VillagerShops' ,
161
- asset : uberJar. outputs. files,
162
- description : versionDesc
163
- ), { -> files(it). files } )
164
- }
150
+ project. zPub_Git. apiKey. set ( props. getProperty(' gitkey' ) )
151
+ project. zPub_Ore. apiKey. set ( props. getProperty(' orekey' ) )
152
+ project. zPub_Discord. apiKey. set( props. getProperty(' discordkey' ) )
165
153
166
- doLast {
167
- TaskFunctors . runDiscordTask(new DiscordBotConfiguration (
168
- apiKey : props. getProperty(' discordkey' ),
169
- server : ' 342942444288999435' ,
170
- channel : ' 352760019873169408' ,
171
- header : " <@&644225680833249320> Version ${ version} released on Ore and GitHub" ,
172
- description : versionDesc
173
- ))
174
- TaskFunctors . terminateJDA()
154
+ project. zPub_Git. messageBody. set ( versionDesc )
155
+ project. zPub_Ore. messageBody. set ( versionDesc )
156
+ project. zPub_Discord. messageBody. set( versionDesc )
175
157
}
176
158
}
159
+ task zPub_Git (type : PublishToGitTask , group :' _Plugin' , dependsOn : z_Publish) {
160
+ gitSlug. set ( ' DosMike/VillagerShops' )
161
+ versionTag. set ( project. version. toString() )
162
+ versionName. set ( " Release Build ${ project.version} " )
163
+ uploadAssets. set( zReleaseZip. outputs. files )
164
+ }
165
+ task zPub_Ore (type : PublishToOreTask , group :' _Plugin' , dependsOn : z_Publish) {
166
+ projectId. set ( pluginid. toString() )
167
+ channel. set ( ' Release' )
168
+ uploadAsset. set( jar. outputs. files )
169
+ }
170
+ task zPub_Discord (type : NotifyDiscordBotTask , group :' _Plugin' , dependsOn : z_Publish) {
171
+ guildId. set ( ' 342942444288999435' )
172
+ channelId. set ( ' 773123356722462752' )
173
+ messageHeader. set( " <@&794978576256335883> Version ${ version} released on Ore and GitHub" )
174
+ finalizedBy(TerminateDiscordBot )
175
+ }
176
+ z_Publish. finalizedBy(zPub_Git)
177
+ zPub_Git. finalizedBy(zPub_Ore)
178
+ zPub_Ore. finalizedBy(zPub_Discord)
177
179
178
180
// for generating the jar
179
181
jar {
0 commit comments