ci: Maven publishing
This commit is contained in:
parent
d948379034
commit
0fde401101
2 changed files with 64 additions and 10 deletions
|
@ -1,13 +1,16 @@
|
||||||
import groovy.xml.XmlParser
|
import groovy.xml.XmlParser
|
||||||
|
import groovy.xml.XmlSlurper
|
||||||
import org.jetbrains.changelog.Changelog
|
import org.jetbrains.changelog.Changelog
|
||||||
import org.jetbrains.changelog.markdownToHTML
|
import org.jetbrains.changelog.markdownToHTML
|
||||||
import org.jetbrains.intellij.tasks.PatchPluginXmlTask
|
import org.jetbrains.intellij.tasks.PatchPluginXmlTask
|
||||||
|
import org.jetbrains.intellij.tasks.PublishPluginTask
|
||||||
|
|
||||||
fun properties(key: String) = providers.gradleProperty(key)
|
fun properties(key: String) = providers.gradleProperty(key)
|
||||||
fun environment(key: String) = providers.environmentVariable(key)
|
fun environment(key: String) = providers.environmentVariable(key)
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java") // Java support
|
id("java") // Java support
|
||||||
|
`maven-publish`
|
||||||
id("java-library")
|
id("java-library")
|
||||||
id("org.jetbrains.intellij") version("1.17.3")
|
id("org.jetbrains.intellij") version("1.17.3")
|
||||||
id("org.jetbrains.changelog") version("2.2.0")
|
id("org.jetbrains.changelog") version("2.2.0")
|
||||||
|
@ -15,6 +18,8 @@ plugins {
|
||||||
id("com.palantir.git-version") version("3.0.0")
|
id("com.palantir.git-version") version("3.0.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val publishVersions = listOf("232", "233", "241", "242")
|
||||||
|
|
||||||
val gitVersion: groovy.lang.Closure<String> by extra
|
val gitVersion: groovy.lang.Closure<String> by extra
|
||||||
|
|
||||||
val grammarKitGenDir = "build/generated/sources/grammarkit/java"
|
val grammarKitGenDir = "build/generated/sources/grammarkit/java"
|
||||||
|
@ -391,15 +396,45 @@ project(":plugin") {
|
||||||
listProductsReleases {
|
listProductsReleases {
|
||||||
types = listOf("IU", "IC", "CL")
|
types = listOf("IU", "IC", "CL")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// publishPlugin {
|
fun distFile(it: String) = layout.buildDirectory.file("dist/ZigBrains-${pluginVersion().get()}-$it-signed.zip")
|
||||||
// dependsOn("patchChangelog")
|
|
||||||
// token = environment("PUBLISH_TOKEN")
|
publishVersions.forEach {
|
||||||
// // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
|
tasks.register<PublishPluginTask>("jbpublish-$it") {
|
||||||
// // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
|
distributionFile.set(distFile(it))
|
||||||
// // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
|
token = environment("IJ_PUBLISH_TOKEN")
|
||||||
// channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
|
}
|
||||||
// }
|
tasks.named("publish") {
|
||||||
|
dependsOn("jbpublish-$it")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("maven") {
|
||||||
|
groupId = "com.falsepattern"
|
||||||
|
artifactId = "zigbrains"
|
||||||
|
version = pluginVersion().get()
|
||||||
|
|
||||||
|
publishVersions.forEach {
|
||||||
|
artifact(distFile(it)) {
|
||||||
|
classifier = "$it-signed"
|
||||||
|
extension = "zip"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "mavenpattern"
|
||||||
|
url = uri("https://mvn.falsepattern.com/releases/");
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("MAVEN_DEPLOY_USER")
|
||||||
|
password = System.getenv("MAVEN_DEPLOY_PASSWORD")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
23
build.sh
23
build.sh
|
@ -15,12 +15,29 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
declare -a branches=("master" "241" "233" "232")
|
declare -a branches=("master" "241" "233" "232")
|
||||||
|
|
||||||
DEFAULT_BRANCH="${branches[0]}"
|
DEFAULT_BRANCH="${branches[0]}"
|
||||||
|
|
||||||
if [[ -z "${PRIVATE_KEY_PASSWORD}" ]]; then
|
if [[ -z "${PRIVATE_KEY_PASSWORD}" ]]; then
|
||||||
echo "Private key password does not exist!"
|
echo "PRIVATE_KEY_PASSWORD missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${MAVEN_DEPLOY_USER}"]]; then
|
||||||
|
echo "MAVEN_DEPLOY_USER missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${MAVEN_DEPLOY_PASSWORD}"]]; then
|
||||||
|
echo "MAVEN_DEPLOY_USER missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${IJ_PUBLISH_TOKEN}"]]; then
|
||||||
|
echo "MAVEN_DEPLOY_USER missing!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -59,4 +76,6 @@ git checkout "$DEFAULT_BRANCH"
|
||||||
|
|
||||||
mkdir -p build/dist
|
mkdir -p build/dist
|
||||||
|
|
||||||
cp plugin/build/distributions/*-signed.zip build/dist/
|
cp plugin/build/distributions/*-signed.zip build/dist/
|
||||||
|
|
||||||
|
./gradlew publish
|
Loading…
Add table
Reference in a new issue