Skip to content

Commit

Permalink
update gradle (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pana authored Jul 4, 2024
1 parent c3ccf54 commit e6fd021
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
34 changes: 16 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ group = 'io.github.conflux-chain'
version = '1.3.0' // SNAPSHOT

repositories {
jcenter()
// mavenCentral()
// jcenter()
mavenCentral()
}

dependencies {
Expand All @@ -39,19 +39,26 @@ test {
useJUnitPlatform()
}

task sourcesJar(type: Jar) {
tasks.register('sourcesJar', Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
tasks.register('javadocJar', Jar) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

tasks.register('printEnvironmentVariable') {
doLast {
println "MY_ENV_VAR: " + findProperty("signing.secretKey") as String
}
}

signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
useInMemoryPgpKeys(
findProperty("signing.secretKey") as String,
findProperty("signing.password") as String
)
sign publishing.publications;
}

Expand Down Expand Up @@ -108,19 +115,10 @@ publishing {
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
name = "OSSRH"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
username = findProperty("maven.username")
password = findProperty("maven.password")
}
}

// maven {
// name = "GitHubPackages"
// url = "https://maven.pkg.github.com/conflux-chain/java-conflux-sdk"
// credentials {
// username = System.getenv("GITHUB_ACTOR")
// password = System.getenv("GITHUB_TOKEN")
// }
// }
}
}

Expand Down
7 changes: 6 additions & 1 deletion docs/how-to-publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
1. Update version in build.gradle
2. 使用 gradle publish 发布到 OSSRH
3. 到 oss.sonatype.org 的 Staging repositories 把将要发布的版本 close 掉
4. 待状态变为 closed 后,进行 Release 操作
4. 待状态变为 closed 后,进行 Release 操作

## Configure

1. 在发布新版本 artifact 到 maven 之前, 需要对他们进行 sign, 签名需要用到 signingPassword 和 signingKey(pgp key); (PS 忘记如何生成了🤣)
2. 在发布到 maven 的时候, 需要通过 `oss.sonatype.org` 生成的 accessToken 来登录, 之前是 userName 和 password, 2024.6 后不再支持

0 comments on commit e6fd021

Please sign in to comment.