Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update build.gradle #53

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 后不再支持
Loading