Add configuration for MavenCentral publishing#779
Draft
zsmb13 wants to merge 2 commits intoBaseflow:masterfrom
Draft
Add configuration for MavenCentral publishing#779zsmb13 wants to merge 2 commits intoBaseflow:masterfrom
zsmb13 wants to merge 2 commits intoBaseflow:masterfrom
Conversation
zsmb13
commented
Jan 18, 2021
photoview/build.gradle
Outdated
Comment on lines
20
to
22
| def PUBLISH_GROUP_ID = 'com.github.chrisbanes' | ||
| def PUBLISH_ARTIFACT_ID = 'PhotoView' | ||
| def PUBLISH_VERSION = '2.3.0' |
Author
There was a problem hiding this comment.
These coordinates might have to be reconsidered as MavenCentral requires verification for publishing with a given group ID
zsmb13
commented
Jan 18, 2021
Comment on lines
24
to
49
| ext["signing.keyId"] = '' | ||
| ext["signing.password"] = '' | ||
| ext["signing.secretKeyRingFile"] = '' | ||
| ext["ossrhUsername"] = '' | ||
| ext["ossrhPassword"] = '' | ||
| ext["sonatypeStagingProfileId"] = '' | ||
|
|
||
| File localPropsFile = project.rootProject.file('local.properties') | ||
| if (localPropsFile.exists()) { | ||
| println "Found local props file, loading props from there" | ||
| Properties p = new Properties() | ||
| new FileInputStream(localPropsFile).withCloseable { is -> | ||
| p.load(is) | ||
| } | ||
| p.each { name, value -> | ||
| ext[name] = value | ||
| } | ||
| } else { | ||
| println "No local props file, loading env vars instead" | ||
| ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') | ||
| ext["signing.password"] = System.getenv('SIGNING_PASSWORD') | ||
| ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') | ||
| ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') | ||
| ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') | ||
| ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') | ||
| } |
Author
There was a problem hiding this comment.
- Set to empty values initially, so that they exist, but are empty. This allows people to build the debug variant locally.
- Use
local.propertiesvalues if they're there, this can be used for publishing from a local machine. - Use environment variables if the
local.propertiesfile was missing, can be used on CI.
|
bump please |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds build configuration to publish the library to MavenCentral, based on this article and this library's config.
This will require the following inputs:
signing.keyId: the ID of the GPG key pair used for signing, the last eight characters of its fingerprintsigning.password: the passphrase of the key pairsigning.secretKeyRingFile: the location of the exported private keyossrhUsernameandosshrPassword: login credentials for https://oss.sonatype.org/stagingProfileId: value from SonatypeUsage:
local.propertiesor environment variables./gradlew assembleRelease(build)./gradlew publishReleasePublicationToSonatypeRepository(sign and upload artifact to Sonatype)./gradlew closeAndReleaseRepository(close and release Sonatype repo)I didn't include CI config in the first draft, but it would be fairly easy and convenient to plug this all into GitHub Actions.