You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* An initialized `fern` folder. See [Set up the `fern`
14
+
folder](/sdks/overview/quickstart).
15
+
* A GitHub repository for your Java SDK. See [Project structure](/sdks/overview/project-structure).
16
+
* A Java generator group in `generators.yml`. See [Java
17
+
Quickstart](quickstart#add-the-sdk-generator).
18
+
19
+
</Info>
20
+
21
+
## Configure Maven Central publication
22
+
23
+
You'll need to update your `generators.yml` file to configure the output location, target repository, and publishing mode. Your `generators.yml`[should live in your source repository](/sdks/overview/project-structure) (or on your local machine), not the repository that contains your Java SDK code.
13
24
14
25
<Steps>
15
26
16
-
<Steptitle="Configure `output` location">
27
+
<Steptitle="Configure `output` location">
17
28
18
-
Change the output location in `generators.yml` from `local-file-system` (the default) to `maven` to indicate that Fern should publish your package directly to the Maven Central registry.
19
-
20
-
Then, add `publish-to: central` to indicate that the publish target is the new Maven Central Portal (Sonatype). To publish to the legacy Nexus Repository, use `publish-to: ossrh`.
29
+
In the `group` for your Java SDK, change the output location in `generators.yml` from `local-file-system` (the default) to `maven` to indicate that Fern should publish your package directly to the Maven Central registry.
30
+
31
+
Then, add `publish-to: central` to indicate that the publish target is the new Maven Central Portal (Sonatype). To publish to the legacy Nexus Repository, use `publish-to: ossrh`.
21
32
22
33
```yaml {6-9} title="generators.yml"
23
34
groups:
@@ -34,7 +45,7 @@ page, you'll have a versioned package published on Maven Central.
34
45
35
46
<Step title="Add repository location">
36
47
37
-
Add the path to your GitHub repository.
48
+
Add the path to the GitHub repository containing your Java SDK:
branch: your-branch-name # Required for mode: push
83
+
```
84
+
85
+
</Step>
54
86
</Steps>
55
87
56
88
## Set up Maven Central publishing authentication
@@ -195,37 +227,130 @@ Finally, upload your key to public key servers so Maven Central can access the s
195
227
```
196
228
</Step>
197
229
</Steps>
230
+
## Publish your SDK
198
231
199
-
## Release your SDK to Maven Central
232
+
Decide how you want to publish your SDK to Maven Central. You can use GitHub workflows for automated releases or publish directly via the CLI.
200
233
201
-
At this point, you're ready to generate a release for your SDK.
234
+
<AccordionGroup>
235
+
236
+
<Accordion title="Release via a GitHub workflow">
237
+
238
+
Set up a release workflow via [GitHub Actions](https://docs.github.com/en/actions/get-started/quickstart) so you can trigger new SDK releases directly from your source repository.
202
239
203
240
<Steps>
204
-
205
-
<Step title="Set Maven environment variables">
241
+
<Step title="Set up authentication">
206
242
207
-
On your local machine, set the the following environment variable to the various tokens you generated in previous steps:
243
+
Open your source repository in GitHub. Click on the **Settings** tab. Then, under the **Security** section, open **Secrets and variables** > **Actions**.
Set up a CI workflow that you can manually trigger from the GitHub UI. In your repository, navigate to **Actions**. Select **New workflow**, then **Set up workflow yourself**. Add a workflow that's similar to this:
Local machine output will verify that the release is pushed to your
227
-
repository and tagged with the version you specified. Log back into Maven Central and
228
-
navigate to **View Deployments** to see your new release.
229
-
</Step>
305
+
<Note>
306
+
You can alternatively configure your workflow to execute `on: [push]`.
307
+
</Note>
308
+
</Step>
309
+
310
+
<Step title="Regenerate and release your SDK">
311
+
312
+
Navigate to the **Actions** tab, select the workflow you just created, specify a version number, and click **Run workflow**. This regenerates your SDK.
0 commit comments