Skip to content

Commit

Permalink
publishing artifact to the central maven repository
Browse files Browse the repository at this point in the history
updated java version to 17 because it is required by plugin org.quiltmc.gradle.licenser. Source and target compatibility is still 11.
  • Loading branch information
alexradzin committed Oct 4, 2023
1 parent d0695e0 commit ca53554
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 16 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- name: Gradle version
uses: gradle/gradle-build-action@v2
with:
arguments: --version
- name: Build and test
uses: gradle/gradle-build-action@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'
- name: Cache SonarCloud packages
uses: actions/cache@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- name: Determine env variables
run: |
if [ "${{ github.event.inputs.environment }}" == 'staging' ]; then
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ jobs:
- name: Deploy to Repsy repository
run: ./gradlew publish
env:
REPSY_USERNAME: ${{ secrets.REPSY_USERNAME }}
REPSY_PASSWORD: ${{ secrets.REPSY_PASSWORD }}
REPSY_USERNAME: ${{ secrets.MAVEN_REPO_USERNAME }}
REPSY_PASSWORD: ${{ secrets.MAVEN_REPO_PASSWORD }}
74 changes: 67 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ plugins {
id "org.sonarqube" version "4.3.1.3277"
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.0.0'
id 'org.quiltmc.gradle.licenser' version '2.0.1'
id 'signing'
}

group 'io.firebolt'
Expand All @@ -22,6 +24,7 @@ project.ext {

java {
withSourcesJar()
withJavadocJar()
}

compileJava {
Expand Down Expand Up @@ -91,6 +94,8 @@ dependencies {
compileTestJava.dependsOn processTestResources
jar.dependsOn processTestResources
jar.dependsOn processIntegrationTestResources
javadoc.dependsOn processTestResources
javadoc.dependsOn processIntegrationTestResources
compileTestCommonJava.dependsOn processTestResources
compileTestCommonJava.dependsOn processIntegrationTestResources
compileIntegrationTestJava.dependsOn processIntegrationTestResources
Expand Down Expand Up @@ -151,7 +156,7 @@ shadowJar {
JarFile jf = new JarFile(jar)
jf.entries().each { entry ->
if (entry.name.endsWith(".class") && entry.name != "module-info.class" &&
!entry.name.startsWith('org/slf4j') && !entry.name.startsWith('ch/qos/logback')) {
!entry.name.startsWith('org/slf4j') && !entry.name.startsWith('ch/qos/logback')) {
packages << entry.name[0..entry.name.lastIndexOf('/')-1].replaceAll('/', '.')
}
}
Expand Down Expand Up @@ -194,22 +199,71 @@ publishing {
publications {
maven(MavenPublication) {
from components.java
pom {
name = "firebolt-jdbc"
description = 'Type 4 JDBC driver that allows connection to Firebolt Database'
url = "https://github.com/firebolt-db/jdbc"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "JonyBoyko"
name = "Ivan Boyko"
email = "[email protected]"
}
developer {
id = "ptiurin"
name = "Petro Tiurin"
email = "[email protected]"
}
developer {
id = "kevin"
name = "Kevin Marr"
email = "[email protected]"
}
developer {
id = "aymeric"
name = "Aymeric Dispa"
email = "[email protected]"
}
developer {
id = "alexradzin"
name = "Alexander Radzin"
email = "[email protected]"
}
developer {
id = "reelsen"
name = "Alexander Reelsen"
email = "[email protected]"
}
}
scm {
connection = "scm:svn:https://github.com/firebolt-db/jdbc/"
developerConnection = "scm:svn:https://github.com/firebolt-db/jdbc/"
url = "https://github.com/firebolt-db/jdbc/"
}
}
// remove dependencies due to shaded jar
pom.withXml {
node = asNode()
node.remove(node.get('dependencies'))
node = asNode()
node.remove(node.get('dependencies'))
}
}
}

repositories {
maven {
def releasesRepoUrl = 'https://repo.repsy.io/mvn/firebolt/maven'
def snapshotsRepoUrl = 'https://repo.repsy.io/mvn/firebolt/maven-snapshots'
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'

url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username System.getenv("REPSY_USERNAME")
password System.getenv("REPSY_PASSWORD")
username System.getenv("MAVEN_REPO_USERNAME")
password System.getenv("MAVEN_REPO_PASSWORD")
}
}
}
Expand All @@ -233,6 +287,7 @@ jar {
}
}


task generateJavadoc(type: Javadoc) {
failOnError false
source = sourceSets.main.allJava
Expand All @@ -244,6 +299,11 @@ task generateJavadoc(type: Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}


signing {
sign publishing.publications
}

if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=2.4.6-SNAPSHOT
version=2.4.6
jdbcVersion=4.3
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void shouldGetDriverMinorVersion() {

@Test
void shouldGetDriverVersion() throws SQLException {
assertEquals("2.4.6-SNAPSHOT", fireboltDatabaseMetadata.getDriverVersion());
assertEquals("2.4.6", fireboltDatabaseMetadata.getDriverVersion());
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/firebolt/jdbc/util/VersionUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void shouldGetDriverMinorVersion() {

@Test
void shouldGetProjectVersion() {
assertEquals("2.4.6-SNAPSHOT", VersionUtil.getDriverVersion());
assertEquals("2.4.6", VersionUtil.getDriverVersion());
}

@Test
Expand Down

0 comments on commit ca53554

Please sign in to comment.