Skip to content

Commit

Permalink
chore(docs): update docs on java publishing (#5487)
Browse files Browse the repository at this point in the history
* update docs on java publishing

* hide table of contents

* update layout

* remove accordion

---------

Co-authored-by: fern-bot <[email protected]>
  • Loading branch information
chdeskur and fern-support authored Dec 26, 2024
1 parent 4f24c7c commit 335a5f4
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 3 deletions.
86 changes: 83 additions & 3 deletions fern/pages/sdks/integration/maven-central.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,88 @@
title: Publish your Java SDK with Maven
---

To make your Java SDK publicly accessible, publish to [Maven](https://central.sonatype.com/). Once you've followed the steps below to connect your Maven account to your SDK, Fern will automatically publish the latest version of your SDK.
To make your Java SDK publicly accessible, publish to [Maven Central](https://central.sonatype.com/). Once you've followed the steps below to connect your Maven account to your SDK, Fern will automatically publish the latest version of your SDK.

## Creating a Maven username and password
<Info>
For more information on the differences between the Central Portal and OSSRH, see the [Maven Central documentation](https://central.sonatype.org/faq/what-is-different-between-central-portal-and-legacy-ossrh/).
</Info>

## Publish via the Central Portal (recommended)
<Steps>
### Log In (or create account) and navigate to your profile
Log into [https://central.sonatype.com/account](https://central.sonatype.com/account).

### Click on `Generate User Token`

Click on `Generate User Token`.

<Frame>
<img src="maven-user-token.png" alt="Select user token" />
</Frame>

### Confirm generation

You will be asked to confirm the generation of the token. This will invalidate any existing token. Click on `Ok`.

### Add Maven Central credentials to GitHub Secrets

You'll need to store two repository secrets in your **fern configuration repository** (**i.e. not the Java SDK repository**),
one for the username and one for the password.

<Frame>
<img src="github-secret.png" alt="Adding GitHub Repository Secret" />
</Frame>

<Info>
For each, select **New repository secret**. Name your secret (we recommend `MAVEN_USERNAME` and `MAVEN_PASSWORD`,
respectively), add the corresponding value, and click **Add secret**.
</Info>

### Sign with GPG

If you don't have gpg installed, you can download the binary from [https://gnupg.org/download/index.html](https://gnupg.org/download/index.html), or install it via package manager.

If you already have a GPG key, you can list your keys:

```sh
gpg --list-secret-keys --keyid-format LONG
```

If you don't have a GPG key, you can generate a new one:

```sh
gpg --gen-key
```

To export your secret key, run:

```sh
gpg --export-secret-keys --armor KEY_ID
```

Be sure to replace `KEY_ID` with the key ID of the key you want to export.

More information is available on [Maven Central's GPG validation page](https://central.sonatype.org/publish/requirements/gpg/).

### Add GPG Signature to GitHub Secrets

You'll need to store repository secrets in your **fern configuration repository**,
for the GPG key id, secret key, and password.

<Frame>
<img src="github-secret.png" alt="Adding GitHub Repository Secret" />
</Frame>

<Info>
For each, select **New repository secret**. Name your secret (we recommend `MAVEN_CENTRAL_SECRET_KEY_KEY_ID`, `MAVEN_CENTRAL_SECRET_KEY`, and `MAVEN_CENTRAL_SECRET_KEY_PASSWORD`, respectively), add the corresponding value, and click **Add secret**.
</Info>


</Steps>

Once you regenerate your SDK, a GitHub action will run to publish directly to Maven!

## Publish via OSSRH (legacy)

<Steps>
### Log In (or create account)
Expand Down Expand Up @@ -51,4 +130,5 @@ one for the username and one for the password.

</Steps>

Once you regenerate your SDK, a GitHub action will run to publish directly to Maven!
Once you regenerate your SDK, a GitHub action will run to publish directly to Maven!

Binary file added fern/pages/sdks/integration/maven-user-token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 335a5f4

Please sign in to comment.