Skip to content

Commit

Permalink
Updates documentation and ready to test the library auto-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
jkleiber committed Nov 30, 2024
1 parent e55d10d commit c820f40
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/publish_library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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:
Expand Down Expand Up @@ -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).
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
```

0 comments on commit c820f40

Please sign in to comment.