Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.diffplug.spotless' version "8.10.0"
}

Expand All @@ -16,6 +17,7 @@ java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
withJavadocJar()
withSourcesJar()
}

Expand All @@ -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()
Expand Down
28 changes: 28 additions & 0 deletions scripts/prepare-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -e

usage() {
echo "Usage: prepare-release.sh <VERSION>"
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}"