Skip to content

Commit

Permalink
feat: add release
Browse files Browse the repository at this point in the history
Signed-off-by: grapebaba <[email protected]>
  • Loading branch information
GrapeBaBa committed Nov 18, 2022
1 parent 0970aa6 commit acc7b5d
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 35 deletions.
File renamed without changes.
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish package to the Maven Central Repository and GitHub Packages
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Execute Gradle build
run: ./gradlew build

- name: Publish package
run: ./gradlew publish
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62 changes: 31 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![sui4j CI](https://github.com/GrapeBaBa/sui4j/actions/workflows/gradle.yml/badge.svg?branch=main)](https://github.com/GrapeBaBa/sui4j/actions/workflows/gradle.yml)
[![sui4j CI](https://github.com/GrapeBaBa/sui4j/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/GrapeBaBa/sui4j/actions/workflows/gradle.yml)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
![Coverage](.github/badges/jacoco.svg)
![Branches](.github/badges/branches.svg)
Expand All @@ -24,7 +24,7 @@ $ ./gradlew build

## Javadoc

For the latest javadocs for the `main` branch, run `./gradlew docs` and open
For the latest javadocs for the `main` branch, run `./gradlew javadoc` and open
the [javadoc](build/docs/javadoc/index.html) in your browser.

## Testing
Expand Down Expand Up @@ -71,103 +71,103 @@ final String BASE_URL="http://localhost:9000";
final JsonHandler jsonHandler=new GsonJsonHandler();

final JsonRpcClientProvider jsonRpcClientProvider=
new OkHttpJsonRpcClientProvider(BASE_URL,jsonHandler);
new OkHttpJsonRpcClientProvider(BASE_URL,jsonHandler);
final SuiClient client=new SuiClientImpl(jsonRpcClientProvider);
```

### sui_getCommitteeInfo

```java
CompletableFuture<CommitteeInfoResponse> res=client.getCommitteeInfo(1L);
CompletableFuture<CommitteeInfoResponse> res=client.getCommitteeInfo(1L);
```

### sui_getEvents

```java
TransactionEventQuery query=new TransactionEventQuery();
query.setTransaction("ov1tDrhdOqRW2uFweTbSSTaQbBbnjHWmrsh675lwb0Q=");
CompletableFuture<PaginatedEvents> res=client.getEvents(query,null,1,false);
TransactionEventQuery query=new TransactionEventQuery();
query.setTransaction("ov1tDrhdOqRW2uFweTbSSTaQbBbnjHWmrsh675lwb0Q=");
CompletableFuture<PaginatedEvents> res=client.getEvents(query,null,1,false);
```

### sui_getMoveFunctionArgTypes

```java
CompletableFuture<List<MoveFunctionArgType>>res=
client.getMoveFunctionArgTypes("0x0000000000000000000000000000000000000002","bag","add");
CompletableFuture<List<MoveFunctionArgType>>res=
client.getMoveFunctionArgTypes("0x0000000000000000000000000000000000000002","bag","add");
```

### sui_getNormalizedMoveFunction

```java
CompletableFuture<MoveNormalizedFunction> res=
client.getNormalizedMoveFunction(
"0x0000000000000000000000000000000000000002","bag","add");
CompletableFuture<MoveNormalizedFunction> res=
client.getNormalizedMoveFunction(
"0x0000000000000000000000000000000000000002","bag","add");
```

### sui_getNormalizedMoveModule

```java
CompletableFuture<MoveNormalizedModule> res=
client.getNormalizedMoveModule("0x0000000000000000000000000000000000000002","bag");
CompletableFuture<MoveNormalizedModule> res=
client.getNormalizedMoveModule("0x0000000000000000000000000000000000000002","bag");
```

### sui_getNormalizedMoveModulesByPackage

```java
CompletableFuture<Map<String, MoveNormalizedModule>>res=
client.getNormalizedMoveModulesByPackage("0x0000000000000000000000000000000000000002");
CompletableFuture<Map<String, MoveNormalizedModule>>res=
client.getNormalizedMoveModulesByPackage("0x0000000000000000000000000000000000000002");
```

### sui_getNormalizedMoveStruct

```java
CompletableFuture<MoveNormalizedStruct> res=
client.getNormalizedMoveStruct("0x0000000000000000000000000000000000000002","bag","Bag");
CompletableFuture<MoveNormalizedStruct> res=
client.getNormalizedMoveStruct("0x0000000000000000000000000000000000000002","bag","Bag");
```

### sui_getObject

```java
CompletableFuture<GetObjectResponse> res=
client.getObject("0x342950ba2451c2f27ed128e591c2b4551e5177c2");
CompletableFuture<GetObjectResponse> res=
client.getObject("0x342950ba2451c2f27ed128e591c2b4551e5177c2");
```

### sui_getObjectsOwnedByAddress

```java
CompletableFuture<List<SuiObjectInfo>>res=
client.getObjectsOwnedByAddress("0xea79464d86786b7a7a63e3f13f798f29f5e65947");
CompletableFuture<List<SuiObjectInfo>>res=
client.getObjectsOwnedByAddress("0xea79464d86786b7a7a63e3f13f798f29f5e65947");
```

### sui_getObjectsOwnedByObject

```java
CompletableFuture<List<SuiObjectInfo>>res=
client.getObjectsOwnedByObject("0xde2952390ab3d0cfbb0a0602532480ed5ec99cf3");
CompletableFuture<List<SuiObjectInfo>>res=
client.getObjectsOwnedByObject("0xde2952390ab3d0cfbb0a0602532480ed5ec99cf3");
```

### sui_getRawObject

```java
CompletableFuture<GetObjectResponse> res=
client.getRawObject("0x342950ba2451c2f27ed128e591c2b4551e5177c2");
CompletableFuture<GetObjectResponse> res=
client.getRawObject("0x342950ba2451c2f27ed128e591c2b4551e5177c2");
```

### sui_getTotalTransactionNumber

```java
CompletableFuture<Long> res=client.getTotalTransactionNumber();
CompletableFuture<Long> res=client.getTotalTransactionNumber();
```

### sui_getTransaction

```java
CompletableFuture<TransactionResponse> res=
client.getTransaction("3Dda4/74LXf6GmOxMxp3qdbW/WdQ6/8EHobZ1LvSyYk=");
CompletableFuture<TransactionResponse> res=
client.getTransaction("3Dda4/74LXf6GmOxMxp3qdbW/WdQ6/8EHobZ1LvSyYk=");
```

### sui_getTransactionsInRange

```java
CompletableFuture<List<String>>res=client.getTransactionsInRange(0L,100L);
```
CompletableFuture<List<String>>res=client.getTransactionsInRange(0L,100L);
```
91 changes: 87 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
plugins {
id 'java'
id 'java-library'
id "checkstyle"
id "jacoco"
id "com.diffplug.spotless" version "6.11.0"
id 'org.unbroken-dome.test-sets' version '4.0.0'
id 'maven-publish'
id 'signing'
}


Expand Down Expand Up @@ -125,9 +127,9 @@ spotless {
}
}

task docs(type: Javadoc) {
source = sourceSets.main.allJava
}
//task docs(type: Javadoc) {
// source = sourceSets.main.allJava
//}

testSets {
integrationTest
Expand All @@ -152,3 +154,84 @@ tasks.withType(Test).configureEach {
]
} as CommandLineArgumentProvider)
}

java {
withJavadocJar()
withSourcesJar()
}

publishing {
publications {
mavenJava(MavenPublication) {
// artifactId = rootProject.name
from components.java
// versionMapping {
// usage('java-api') {
// fromResolutionOf('runtimeClasspath')
// }
// usage('java-runtime') {
// fromResolutionResult()
// }
// }
pom {
name = rootProject.name
description = 'A java SDK for @MystenLabs/sui blockchain.'
url = 'https://github.com/GrapeBaBa/sui4j'
// properties = [
// myProp: "value",
// "prop.with.dots": "anotherValue"
// ]
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'grapebaba'
name = 'Kai Chen'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/GrapeBaBa/' + rootProject.name + '.git'
developerConnection = 'scm:git:ssh://github.com/GrapeBaBa/' + rootProject.name + '.git'
url = 'https://github.com/GrapeBaBa/' + rootProject.name
}
}
}
}
repositories {
maven {
name = "OSSRH"
// change URLs to point to your repos, e.g. http://my.org/repo
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/GrapeBaBa/" + rootProject.name
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}

signing {
sign publishing.publications.mavenJava
}


javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}

0 comments on commit acc7b5d

Please sign in to comment.