Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBX-2936 Set up automated releases for Hibernate Tools #4962

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
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
20 changes: 20 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
wrapperVersion=3.3.2
distributionType=bin
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar
5 changes: 5 additions & 0 deletions ant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
<description>Hibernate Tools Ant Tasks</description>
<packaging>jar</packaging>

<properties>
<!-- This is a publicly distributed module that should be published: -->
<deploy.skip>false</deploy.skip>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
Expand Down
107 changes: 107 additions & 0 deletions ci/release/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* Hibernate Tools, Tooling for your Hibernate Projects
*
* Copyright 2016-2024 Red Hat, Inc.
*
* Licensed under the GNU Lesser General Public License (LGPL),
* version 2.1 or later (the "License").
* You may not use this file except in compliance with the License.
* You may read the licence in the 'lgpl.txt' file in the root folder of
* project or obtain a copy at
*
* http://www.gnu.org/licenses/lgpl-2.1.html
*
* 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.
*/
@Library('hibernate-jenkins-pipeline-helpers') _

import org.hibernate.jenkins.pipeline.helpers.version.Version

pipeline {
agent {
label 'Worker&&Containers'
}
tools {
maven 'Apache Maven 3.9'
jdk 'OpenJDK 21 Latest'
}
options {
buildDiscarder logRotator(daysToKeepStr: '30', numToKeepStr: '10')
disableConcurrentBuilds(abortPrevious: false)
}
parameters {
string(
name: 'RELEASE_VERSION',
defaultValue: '',
description: 'The version to be released, e.g. 7.0.0.Final.',
trim: true
)
string(
name: 'DEVELOPMENT_VERSION',
defaultValue: '',
description: 'The next version to be used after the release, e.g. 7.0.1-SNAPSHOT.',
trim: true
)
booleanParam(
name: 'RELEASE_DRY_RUN',
defaultValue: false,
description: 'If true, just simulate the release, without pushing any commits or tags, and without uploading any artifacts or documentation.'
)
}
stages {
stage('Release') {
when {
beforeAgent true
// Releases must be triggered explicitly
// This is just for safety; normally the Jenkins job for this pipeline
// should be configured to "Suppress automatic SCM triggering"
// See https://stackoverflow.com/questions/58259326/prevent-jenkins-multibranch-pipeline-from-triggering-builds-for-new-branches
triggeredBy cause: "UserIdCause"
}
steps {
script {
// Check that all the necessary parameters are set
if (!params.RELEASE_VERSION) {
throw new IllegalArgumentException("Missing value for parameter RELEASE_VERSION.")
}
if (!params.DEVELOPMENT_VERSION) {
throw new IllegalArgumentException("Missing value for parameter DEVELOPMENT_VERSION.")
}

def releaseVersion = Version.parseReleaseVersion(params.RELEASE_VERSION)
def developmentVersion = Version.parseDevelopmentVersion(params.DEVELOPMENT_VERSION)
echo "Performing full release for version ${releaseVersion.toString()}"

withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven',
mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') {
configFileProvider([configFile(fileId: 'release.config.ssh', targetLocation: env.HOME + '/.ssh/config'),
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) {
// using MAVEN_GPG_PASSPHRASE (the default env variable name for passphrase in maven gpg plugin)
withCredentials([file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
string(credentialsId: 'release.gpg.passphrase', variable: 'MAVEN_GPG_PASSPHRASE')]) {
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
sh 'cat $HOME/.ssh/config'
sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git'
env.RELEASE_GPG_HOMEDIR = env.WORKSPACE_TMP + '/.gpg'
sh """
bash -xe hibernate-release-scripts/release.sh ${params.RELEASE_DRY_RUN ? '-d' : ''} \
tools ${releaseVersion.toString()} ${developmentVersion.toString()}
"""
}
}
}
}
}
}
}
}
post {
always {
notifyBuildResult notifySuccessAfterSuccess: true, maintainers: '[email protected]'
}
}
}
37 changes: 35 additions & 2 deletions gradle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
Expand All @@ -26,6 +26,7 @@
</parent>

<artifactId>hibernate-tools-gradle</artifactId>
<packaging>pom</packaging>

<name>Hibernate Tools Gradle Plugin</name>
<description>Gradle plugin to provide hibernate-tools reverse engineering and code/schema generation abilities.</description>
Expand All @@ -37,9 +38,19 @@
</issueManagement>

<properties>
<!-- This is a publicly distributed module that should be published: -->
<deploy.skip>false</deploy.skip>

<gradle.executable>./gradlew</gradle.executable>
</properties>


<dependencies>
<dependency>
<groupId>org.hibernate.tool</groupId>
<artifactId>hibernate-tools-orm</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<!-- execute Gradle command -->
Expand All @@ -64,6 +75,28 @@
</execution>
</executions>
</plugin>
<!-- As the artifact is built by Gradle, we attach it with the helper plugin so that it gets published: -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.basedir}/plugin/build/libs/${project.artifactId}-${project.version}.jar</file>
<type>jar</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
9 changes: 7 additions & 2 deletions jbt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
~
~ Copyright 2022-2023 Red Hat, Inc.
~
~ Licensed under the GNU Lesser General Public License (LGPL),
~ Licensed under the GNU Lesser General Public License (LGPL),
~ version 2.1 or later (the "License").
~ You may not use this file except in compliance with the License.
~ You may read the licence in the 'lgpl.txt' file in the root folder of
~ You may read the licence in the 'lgpl.txt' file in the root folder of
~ project or obtain a copy at
~
~ http://www.gnu.org/licenses/lgpl-2.1.html
Expand Down Expand Up @@ -35,6 +35,11 @@
<name>Hibernate Tools ORM - JBoss Tools Adapter</name>
<description>Hibernate Tools ORM - JBoss Tools Adapter</description>

<properties>
<!-- This is a publicly distributed module that should be published: -->
<deploy.skip>false</deploy.skip>
</properties>

<dependencies>
<dependency>
<groupId>com.h2database</groupId>
Expand Down
3 changes: 2 additions & 1 deletion maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
</prerequisites>

<properties>
<maven.deploy.skip>false</maven.deploy.skip>
<!-- This is a publicly distributed module that should be published: -->
<deploy.skip>false</deploy.skip>
<maven.install.skip>false</maven.install.skip>

<maven-plugin-annotations.version>3.5</maven-plugin-annotations.version>
Expand Down
Loading
Loading