diff --git a/.github/workflows/publish_library.yml b/.github/workflows/publish_library.yml index f0f397c..0700b05 100644 --- a/.github/workflows/publish_library.yml +++ b/.github/workflows/publish_library.yml @@ -31,8 +31,7 @@ jobs: uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 - name: Publish package - # run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache - run: ./gradlew publishToMavenCentral --no-configuration-cache + run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} diff --git a/README.md b/README.md index aec45a6..d8ca2b5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ # coppercore -## Maintaining Maven Central Publishing +## Maven Central +This project is available on maven central! The instructions below outline how to set this up. + +### Secret Keys In order to publish on Maven Central, multiple secret keys must be maintained. The GPG key and the Sonatype token are independent though, and can be regenerated as needed without updating the other one. @@ -20,6 +23,8 @@ To temporarily set any of these variables locally for testing, you can do the fo $env.ENV_VARIABLE_NAME = "environment-variable-value" ``` +More information about environment variables can be found [on the docs page of our gradle plugin of choice](https://vanniktech.github.io/gradle-maven-publish-plugin/central/#secrets) for publishing to the Central Portal. + ### Generating a GPG key To generate the GPG key, first generate a key locally: @@ -49,4 +54,23 @@ Finally, you need to publish the **public** key so users can actually verify the gpg --keyserver keyserver.ubuntu.com KEY-ID ``` -More information on generating GPG keys can be found [on the Sonatype docs](https://central.sonatype.org/publish/requirements/gpg/) or on the [GitHub docs](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key). \ No newline at end of file +More information on generating GPG keys can be found [on the Sonatype docs](https://central.sonatype.org/publish/requirements/gpg/) or on the [GitHub docs](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key). + +### Publishing + +#### GitHub Actions + +Whenever a release is created on GitHub, the `publish_library` action will automatically publish the released version to the Central Portal. At any time this workflow can be run manually as well. + +The `stage_library` GitHub action can be run manually to confirm that the library stages on the Central Portal. This can be used to preview a release to the Central Portal and also to ensure the maven central formatting is followed correctly. + +#### Locally +To stage the package on the Central Portal for future (manual) release, run the following command: +``` +./gradlew publishToMavenCentral --no-configuration-cache +``` + +Or, to automatically stage and publish a version run: +``` +./gradlew publishAndReleaseToMavenCentral --no-configuration-cache +``` \ No newline at end of file