-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issues/120 - Added gradle setting for publishing to network.casper MV…
…N repo
- Loading branch information
Showing
8 changed files
with
95 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,27 @@ | ||
# This workflow will build a Java project with Gradle | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
|
||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
branches: [ "issues/120" ] | ||
pull_request: | ||
branches: [ main ] | ||
branches: [ "issues/120" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build | ||
|
||
publish-docs-reports: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
|
||
java-version: '8' | ||
distribution: 'temurin' | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Export project version | ||
run: echo "PROJECT_VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')" >> $GITHUB_ENV | ||
|
||
- name: Generate Javadoc | ||
run: ./gradlew javadoc | ||
|
||
- name: Run tests and generate reports | ||
run: ./gradlew test | ||
|
||
- name: Deploy tests results to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
clean: true | ||
folder: build/reports/tests | ||
target-folder: docs/latest/junit | ||
- name: Deploy jacoco report to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
clean: true | ||
folder: build/reports/jacoco | ||
target-folder: docs/latest/jacoco | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
clean: true | ||
folder: build/docs/javadoc | ||
target-folder: docs/latest/javadoc | ||
|
||
- name: Deploy tests results to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
clean: true | ||
folder: build/reports/tests | ||
target-folder: docs/${{ env.PROJECT_VERSION }}/junit | ||
- name: Deploy jacoco report to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
clean: true | ||
folder: build/reports/jacoco | ||
target-folder: docs/${{ env.PROJECT_VERSION }}/jacoco | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
clean: true | ||
folder: build/docs/javadoc | ||
target-folder: docs/${{ env.PROJECT_VERSION }}/javadoc | ||
- name: Build with Gradle | ||
run: ./gradlew clean build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,11 @@ plugins { | |
id 'jacoco' | ||
id 'signing' | ||
id 'maven-publish' | ||
id('io.github.gradle-nexus.publish-plugin') version '1.1.0' | ||
} | ||
|
||
group = 'com.syntifi.casper' | ||
version = '0.2.1' | ||
group = 'network.casper' | ||
version = '0.5.0-SNAPSHOT' | ||
sourceCompatibility = '8' | ||
|
||
repositories { | ||
|
@@ -48,12 +49,30 @@ java { | |
withSourcesJar() | ||
} | ||
|
||
task casperJar(type: Jar) { | ||
archiveBaseName = 'casper-java-sdk' | ||
archiveVersion = "$version" | ||
from { configurations.compileClasspath.findAll { it.isDirectory() ? it : zipTree(it) } } | ||
with jar | ||
} | ||
|
||
javadoc { | ||
if (JavaVersion.current().isJava9Compatible()) { | ||
options.addBooleanOption('html5', true) | ||
} | ||
} | ||
|
||
nexusPublishing { | ||
repositories { | ||
sonatype { //only for users registered in Sonatype after 24 Feb 2021 | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
username.set(System.getenv('MAVEN_USERNAME')) | ||
password.set(System.getenv('MAVEN_PASSWORD')) | ||
} | ||
} | ||
} | ||
|
||
test { | ||
finalizedBy jacocoTestReport | ||
|
||
|
@@ -106,19 +125,9 @@ jacocoTestReport { | |
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = 'OSSRH' | ||
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('MAVEN_USERNAME') | ||
password = System.getenv('MAVEN_PASSWORD') | ||
} | ||
} | ||
maven { | ||
name = "GitHubPackages" | ||
url = "https://maven.pkg.github.com/syntifi/casper-sdk" | ||
url = "https://maven.pkg.github.com/casper-network/casper-java-sdk" | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
|
@@ -128,34 +137,34 @@ publishing { | |
|
||
publications { | ||
mavenJava(MavenPublication) { | ||
artifactId = 'casper-sdk' | ||
artifactId = 'casper-java-sdk' | ||
from components.java | ||
pom { | ||
name = 'Java 8+ Casper RPC Client SDK' | ||
name = 'Casper Java SDK' | ||
packaging = 'jar' | ||
description = 'This project implements the SDK to interact with a Casper Node. It wraps the Json-RPC requests and maps the results to Java objects.' | ||
url = 'https://github.com/syntifi/casper-sdk' | ||
description = 'SDK to streamline the 3rd party Java client integration processes. Such 3rd parties include exchanges & app developers.' | ||
url = 'https://github.com/casper-network/casper-java-sdk' | ||
|
||
scm { | ||
connection = 'scm:git:https://github.com/syntifi/casper-sdk.git' | ||
developerConnection = '[email protected]:syntifi/casper-sdk.git' | ||
url = 'https://github.com/syntifi/casper-sdk' | ||
connection = 'scm:git:https://github.com/casper-network/casper-java-sdk.git' | ||
developerConnection = '[email protected]:casper-network/casper-java-sdk.git' | ||
url = 'https://github.com/casper-network/casper-java-sdk' | ||
} | ||
|
||
issueManagement { | ||
system = 'GitHub' | ||
url = 'https://github.com/syntifi/casper-sdk/issues' | ||
url = 'https://github.com/casper-network/casper-java-sdk/issues' | ||
} | ||
|
||
ciManagement { | ||
system = 'Github Actions' | ||
url = 'https://github.com/syntifi/casper-sdk/actions' | ||
url = 'https://github.com/casper-network/casper-java-sdk/actions' | ||
} | ||
|
||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
|
||
|
@@ -170,16 +179,31 @@ publishing { | |
name = 'Andre Bertolace' | ||
email = '[email protected]' | ||
} | ||
developer { | ||
id = 'meywood' | ||
name = 'Ian Mills' | ||
email = '[email protected]' | ||
} | ||
developer { | ||
id = 'stormeye' | ||
name = 'Carl Norburn' | ||
email = '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Reference at https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys | ||
signing { | ||
def signingKey = System.getenv('GPG_SIGNING_KEY') ?: findProperty('GPG_SIGNING_KEY') | ||
def signingKeyPassword = System.getenv('GPG_SIGNING_KEY_PASSWORD') ?: findProperty('GPG_SIGNING_KEY_PASSWORD') | ||
useInMemoryPgpKeys(signingKey, signingKeyPassword) | ||
sign publishing.publications.mavenJava | ||
jar { | ||
archiveClassifier = '' | ||
} | ||
|
||
// Reference at https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys | ||
signing { | ||
def signingKey = System.getenv('GPG_SIGNING_KEY') ?: findProperty('GPG_SIGNING_KEY') | ||
def signingKeyPassword = System.getenv('GPG_SIGNING_KEY_PASSWORD') ?: findProperty('GPG_SIGNING_KEY_PASSWORD') | ||
|
||
useInMemoryPgpKeys(signingKey, signingKeyPassword) | ||
sign publishing.publications.mavenJava | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.