diff --git a/build.gradle b/build.gradle index 4752f5c..05e3752 100644 --- a/build.gradle +++ b/build.gradle @@ -16,8 +16,8 @@ group = 'io.github.conflux-chain' version = '1.3.0' // SNAPSHOT repositories { - jcenter() -// mavenCentral() +// jcenter() + mavenCentral() } dependencies { @@ -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; } @@ -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") -// } -// } } } diff --git a/docs/how-to-publish.md b/docs/how-to-publish.md index ab237b4..fc8eda7 100644 --- a/docs/how-to-publish.md +++ b/docs/how-to-publish.md @@ -3,4 +3,9 @@ 1. Update version in build.gradle 2. 使用 gradle publish 发布到 OSSRH 3. 到 oss.sonatype.org 的 Staging repositories 把将要发布的版本 close 掉 -4. 待状态变为 closed 后,进行 Release 操作 \ No newline at end of file +4. 待状态变为 closed 后,进行 Release 操作 + +## Configure + +1. 在发布新版本 artifact 到 maven 之前, 需要对他们进行 sign, 签名需要用到 signingPassword 和 signingKey(pgp key); (PS 忘记如何生成了🤣) +2. 在发布到 maven 的时候, 需要通过 `oss.sonatype.org` 生成的 accessToken 来登录, 之前是 userName 和 password, 2024.6 后不再支持 \ No newline at end of file