|
1 | | -import org.zaproxy.gradle.addon.AddOnPlugin |
2 | 1 | import org.zaproxy.gradle.addon.AddOnStatus |
| 2 | +import org.zaproxy.gradle.addon.internal.model.ProjectInfo |
| 3 | +import org.zaproxy.gradle.addon.internal.model.ReleaseState |
| 4 | +import org.zaproxy.gradle.addon.internal.tasks.GenerateReleaseStateLastCommit |
3 | 5 | import org.zaproxy.gradle.addon.misc.ConvertMarkdownToHtml |
4 | | -import org.zaproxy.gradle.addon.misc.CreateGitHubRelease |
5 | | -import org.zaproxy.gradle.addon.misc.ExtractLatestChangesFromChangelog |
6 | 6 |
|
7 | 7 | plugins { |
8 | 8 | `java-library` |
9 | | - id("org.zaproxy.add-on") version "0.5.0" |
| 9 | + id("org.zaproxy.add-on") version "0.6.0" |
10 | 10 | id("com.diffplug.spotless") version "5.12.1" |
11 | 11 | } |
12 | 12 |
|
13 | 13 | repositories { |
14 | 14 | mavenCentral() |
15 | 15 | } |
16 | 16 |
|
17 | | -version = "10" |
18 | 17 | description = "Useful ZAP scripts written by the ZAP community." |
19 | 18 |
|
20 | 19 | val scriptsDir = layout.buildDirectory.dir("scripts") |
@@ -112,33 +111,15 @@ spotless { |
112 | 111 | } |
113 | 112 | } |
114 | 113 |
|
115 | | -System.getenv("GITHUB_REF")?.let { ref -> |
116 | | - if ("refs/tags/" !in ref) { |
117 | | - return@let |
118 | | - } |
119 | | - |
120 | | - tasks.register<CreateGitHubRelease>("createReleaseFromGitHubRef") { |
121 | | - val targetTag = ref.removePrefix("refs/tags/") |
122 | | - val targetAddOnVersion = targetTag.removePrefix("v") |
123 | | - |
124 | | - authToken.set(System.getenv("GITHUB_TOKEN")) |
125 | | - repo.set(System.getenv("GITHUB_REPOSITORY")) |
126 | | - tag.set(targetTag) |
127 | | - |
128 | | - title.set(provider { "Version ${zapAddOn.addOnVersion.get()}" }) |
129 | | - bodyFile.set(tasks.named<ExtractLatestChangesFromChangelog>("extractLatestChanges").flatMap { it.latestChanges }) |
130 | | - |
131 | | - assets { |
132 | | - register("add-on") { |
133 | | - file.set(tasks.named<Jar>(AddOnPlugin.JAR_ZAP_ADD_ON_TASK_NAME).flatMap { it.archiveFile }) |
134 | | - } |
135 | | - } |
| 114 | +val projectInfo = ProjectInfo.from(project) |
| 115 | +val generateReleaseStateLastCommit by tasks.registering(GenerateReleaseStateLastCommit::class) { |
| 116 | + projects.set(listOf(projectInfo)) |
| 117 | +} |
136 | 118 |
|
137 | | - doFirst { |
138 | | - val addOnVersion = zapAddOn.addOnVersion.get() |
139 | | - require(addOnVersion == targetAddOnVersion) { |
140 | | - "Version of the tag $targetAddOnVersion does not match the version of the add-on $addOnVersion" |
141 | | - } |
142 | | - } |
| 119 | +val releaseAddOn by tasks.registering { |
| 120 | + if (ReleaseState.read(projectInfo).isNewRelease()) { |
| 121 | + dependsOn("createRelease") |
| 122 | + dependsOn("handleRelease") |
| 123 | + dependsOn("createPullRequestNextDevIter") |
143 | 124 | } |
144 | 125 | } |
0 commit comments