diff --git a/build.gradle b/build.gradle index cb3847f..59a01ee 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'java-library' id 'maven-publish' + id 'signing' id 'com.diffplug.spotless' version "8.10.0" } @@ -16,6 +17,7 @@ java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } + withJavadocJar() withSourcesJar() } @@ -39,18 +41,38 @@ publishing { publications { javaMatrixBotLib(MavenPublication) { from components.java + pom { + name = "Java Matrix Bot Lib" + description = "Library proving an API to interact with a matrix server as a bot." + url = "https://github.com/synyx/java-matrix-bot-lib" + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + scm { + connection = 'scm:git:git://github.com/synyx/java-matrix-bot-lib.git' + developerConnection = 'scm:git:ssh://github.com:synyx/java-matrix-bot-lib.git' + url = 'https://github.com/synyx/java-matrix-bot-lib' + } + } } } repositories { maven { - name = 'synyxPublicReleases' - url = uri('https://nexus.synyx.de/repository/public-releases/') - credentials(PasswordCredentials) + name = "LocalMavenWithChecksums" + url = uri(layout.buildDirectory.dir("staging-deploy")) } } } +signing { + useGpgCmd() + sign publishing.publications.javaMatrixBotLib +} + spotless { groovyGradle { greclipse() diff --git a/scripts/prepare-release.sh b/scripts/prepare-release.sh new file mode 100755 index 0000000..48cb135 --- /dev/null +++ b/scripts/prepare-release.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +usage() { + echo "Usage: prepare-release.sh " + echo " VERSION must be in semver format (e.g. 1.0.0)" +} + +# Go to root dir +cd "$(dirname "$0")/.." || exit 2 + +VERSION="$1" + +if [[ ! ("${VERSION}" =~ ^[0-9]+\.[0-9]\.[0-9]$) ]]; then + usage + exit 1 +fi + +STAGING_FOLDER="build/staging-deploy" +OUTFILE="java-matrix-bot-lib-${VERSION}.zip" +./gradlew -Pversion="${VERSION}" clean build publishJavaMatrixBotLibPublicationToLocalMavenWithChecksumsRepository +pushd "${STAGING_FOLDER}" +[ -e "${OUTFILE}" ] && rm -- "${OUTFILE}" +zip -r "${OUTFILE}" ./org/synyx/java-matrix-bot-lib +popd +echo "" +echo "Successfully created release ${STAGING_FOLDER}/${OUTFILE}" +echo "Deployment Name: org.synyx:java-matrix-bot-lib:${VERSION}"