publishing
This commit is contained in:
parent
f7014b49eb
commit
84dfdd804b
2 changed files with 133 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
import org.jetbrains.changelog.Changelog
|
import org.jetbrains.changelog.Changelog
|
||||||
import org.jetbrains.changelog.markdownToHTML
|
import org.jetbrains.changelog.markdownToHTML
|
||||||
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
|
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
|
||||||
|
import org.jetbrains.intellij.platform.gradle.tasks.PublishPluginTask
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
|
||||||
|
|
||||||
|
@ -11,7 +12,11 @@ plugins {
|
||||||
id("org.jetbrains.changelog") version "2.2.1"
|
id("org.jetbrains.changelog") version "2.2.1"
|
||||||
id("org.jetbrains.grammarkit") version "2022.3.2.2" apply false
|
id("org.jetbrains.grammarkit") version "2022.3.2.2" apply false
|
||||||
idea
|
idea
|
||||||
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
val publishVersions = listOf("241", "242", "243")
|
||||||
|
val pluginVersionFull get() = "$pluginVersion-$pluginSinceBuild"
|
||||||
|
val pluginVersion: String by project
|
||||||
val pluginSinceBuild: String by project
|
val pluginSinceBuild: String by project
|
||||||
val pluginUntilBuild: String by project
|
val pluginUntilBuild: String by project
|
||||||
val javaVersion = property("javaVersion").toString().toInt()
|
val javaVersion = property("javaVersion").toString().toInt()
|
||||||
|
@ -21,7 +26,7 @@ val lsp4ijNightly = property("lsp4ijNightly").toString().toBoolean()
|
||||||
val lsp4ijPluginString = "com.redhat.devtools.lsp4ij:$lsp4ijVersion${if (lsp4ijNightly) "@nightly" else ""}"
|
val lsp4ijPluginString = "com.redhat.devtools.lsp4ij:$lsp4ijVersion${if (lsp4ijNightly) "@nightly" else ""}"
|
||||||
|
|
||||||
group = "com.falsepattern"
|
group = "com.falsepattern"
|
||||||
version = providers.gradleProperty("pluginVersion").get()
|
version = pluginVersionFull
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
|
@ -186,4 +191,50 @@ tasks {
|
||||||
classes {
|
classes {
|
||||||
enabled = false
|
enabled = false
|
||||||
}
|
}
|
||||||
|
verifyPluginSignature {
|
||||||
|
certificateChainFile = file("secrets/chain.crt")
|
||||||
|
inputArchiveFile = signPlugin.map { it.signedArchiveFile }.get()
|
||||||
|
dependsOn(signPlugin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun distFile(it: String) = layout.buildDirectory.file("dist/ZigBrains-$pluginVersion-$it-signed.zip")
|
||||||
|
|
||||||
|
publishVersions.forEach {
|
||||||
|
tasks.register<PublishPluginTask>("jbpublish-$it").configure {
|
||||||
|
archiveFile = distFile(it)
|
||||||
|
token = providers.environmentVariable("IJ_PUBLISH_TOKEN")
|
||||||
|
channels = if (pluginVersion.contains("-")) listOf("nightly") else listOf("default")
|
||||||
|
}
|
||||||
|
tasks.named("publish").configure {
|
||||||
|
dependsOn("jbpublish-$it")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("maven") {
|
||||||
|
groupId = "com.falsepattern"
|
||||||
|
artifactId = "zigbrains"
|
||||||
|
version = pluginVersion
|
||||||
|
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
81
build.sh
Normal file
81
build.sh
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright 2023-2024 FalsePattern
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
declare -a branches=("master" "242" "241")
|
||||||
|
|
||||||
|
DEFAULT_BRANCH="${branches[0]}"
|
||||||
|
|
||||||
|
if [[ -z "${PRIVATE_KEY_PASSWORD}" ]]; then
|
||||||
|
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_PASSWORD missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${IJ_PUBLISH_TOKEN}" ]]; then
|
||||||
|
echo "IJ_PUBLISH_TOKEN missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f secrets/chain.crt ]; then
|
||||||
|
echo "secrets/chain.crt missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f secrets/private.pem ]; then
|
||||||
|
echo "secrets/private.pem missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git checkout "$DEFAULT_BRANCH" && ./gradlew clean
|
||||||
|
|
||||||
|
RESULT=$?
|
||||||
|
|
||||||
|
if [ $RESULT != 0 ]; then
|
||||||
|
echo "Failed to clean!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
for i in "${branches[@]}"
|
||||||
|
do
|
||||||
|
echo "Building branch $i"
|
||||||
|
git checkout "$i" && ./gradlew verifyPluginSignature
|
||||||
|
RESULT=$?
|
||||||
|
if [ $RESULT != 0 ]; then
|
||||||
|
echo "Failed to build plugin on branch $i!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
git checkout "$DEFAULT_BRANCH"
|
||||||
|
|
||||||
|
mkdir -p build/dist
|
||||||
|
|
||||||
|
cp build/distributions/*-signed.zip build/dist/
|
||||||
|
|
||||||
|
./gradlew publish
|
Loading…
Add table
Reference in a new issue