From 42a98716ed7361cbdc4caf6703a568cdb457ab23 Mon Sep 17 00:00:00 2001 From: Usman Saleem Date: Tue, 12 Mar 2024 11:31:17 +1000 Subject: [PATCH] ci: Publish to JFrog Artifactory (#5) Publish to JFrog Artifactory. Change maven group id to org.hyperledger.besu Change pre release version to 0.1.1 Signed-off-by: Usman Saleem --- .github/workflows/publish.yml | 8 +++++++- build.gradle | 24 +++++++++++++++++++++++- gradle.properties | 2 +- gradle/libs.versions.toml | 4 +++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aa70cb0..9f28d78 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,4 +31,10 @@ jobs: - name: Publish to GitHub Packages run: ./gradlew publish env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to JFrog Artifactory + run: ./gradlew artifactoryPublish + env: + ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} + ARTIFACTORY_KEY: ${{ secrets.BESU_ARTIFACTORY }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index a3e5f7b..6eae27e 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id 'java-library' id 'maven-publish' alias libs.plugins.spotless + alias libs.plugins.artifactory } repositories { @@ -99,7 +100,7 @@ spotless { publishing { publications { library(MavenPublication) { - groupId = 'org.hyperledger.errorpronechecks' + groupId = 'org.hyperledger.besu' from components.java versionMapping { usage('java-api') { @@ -138,4 +139,25 @@ publishing { } } } + + def artifactoryUser = project.hasProperty('artifactoryUser') ? project.property('artifactoryUser') : System.getenv('ARTIFACTORY_USER') + def artifactoryKey = project.hasProperty('artifactoryApiKey') ? project.property('artifactoryApiKey') : System.getenv('ARTIFACTORY_KEY') + def artifactoryRepo = System.getenv('ARTIFACTORY_REPO') ?: 'besu-maven' + def artifactoryOrg = System.getenv('ARTIFACTORY_ORG') ?: 'hyperledger' + + artifactory { + contextUrl = "https://hyperledger.jfrog.io/${artifactoryOrg}" + publish { + repository { + repoKey = artifactoryRepo + username = artifactoryUser + password = artifactoryKey + } + defaults { + publications('library') + publishArtifacts = true + publishPom = true + } + } + } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 8936977..fab2ef3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=0.1.0 +version=0.1.1 org.gradle.welcome=never diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cc30946..a7a8556 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,6 +10,7 @@ slf4j = "2.0.10" picocli = "4.7.5" jetbrain-annotations = "24.1.0" spotless = "6.25.0" +artifactory = "5.2.0" [libraries] picocli = { module = "info.picocli:picocli", version.ref = "picocli" } @@ -28,4 +29,5 @@ junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "jun assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" } [plugins] -spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } \ No newline at end of file +spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } +artifactory = { id = "com.jfrog.artifactory", version.ref = "artifactory" }