Skip to content

Commit 7dcd966

Browse files
Update CI to publish Java SDK (#16)
1 parent c2dd547 commit 7dcd966

File tree

6 files changed

+43
-40
lines changed

6 files changed

+43
-40
lines changed

.github/workflows/ci.yml

+10-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ jobs:
66
fern-check:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
9+
- name: Checkout repo
10+
uses: actions/checkout@v3
1011

1112
- name: Install Fern
1213
run: npm install -g fern-api
@@ -19,16 +20,19 @@ jobs:
1920
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
2021
runs-on: ubuntu-latest
2122
steps:
22-
- uses: actions/checkout@v2
23+
- name: Checkout repo
24+
uses: actions/checkout@v3
2325

2426
- name: Setup node
25-
uses: actions/setup-node@v2
27+
uses: actions/setup-node@v3
2628

27-
- name: Download fern
29+
- name: Download Fern
2830
run: npm install -g fern-api
2931

3032
- name: Release SDKs
3133
env:
3234
FERN_NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
33-
run: fern release ${{github.ref_name}} --log-level debug
34-
35+
FERN_MAVEN_USERNAME: ${{ secrets.FERN_MAVEN_USERNAME }}
36+
FERN_MAVEN_TOKEN: ${{ secrets.FERN_MAVEN_TOKEN }}
37+
run: fern release ${{ github.ref_name }} --log-level debug
38+

README.md

+15-29
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,37 @@
11
# Raven API
22

3-
Tagging a release on this repository will generate and release new SDKs. Currently included SDKs:
3+
Tagging a release on this repository will update the:
44

5-
- JavaScript/TypeScript SDK: https://github.com/ravenappdev/raven-node
6-
7-
## [tl;dr] How does it work?
8-
9-
1. When you tag a release, Fern generates SDKs based on the Fern API Definition in this repo.
10-
1. Each generated SDK is pushed to its own GitHub repo.
11-
1. Each SDK's repo has GitHub actions that compile the code and publish the package to its respective registry.
5+
- [TypeScript SDK Github Repo](https://github.com/ravenappdev/raven-node)
6+
- [Java SDK Github Repo](https://github.com/ravenappdev/raven-java)
7+
- _More SDKs to come..._
128

139
## What is in this repository?
1410

1511
This repository contains
1612

17-
- Raven's [Fern API Definition](./fern/api/definition/)
18-
- Enabled generators ([generators.yml](./fern/api/generators.yml))
13+
- Raven's Fern API Definition which lives in the [definition](./fern/api/definition/) folder
14+
- Generators (see [generators.yml](./fern/api/generators.yml))
1915

2016
## What is in the API Definition?
2117

22-
The API Definition contains information about what endpoints, types, and errors are used in the API. The definition is broken into smaller files such as [device.yml](fern/api/definition/device.yml) and [event.yml](fern/api/definition/event.yml).
18+
The API Definition contains information about what endpoints, types, and errors are used in the API. The definition is broken into smaller files such as [device.yml](fern/api/definition/device.yml).
2319

2420
In order to make sure that the definition is valid, you can use the Fern CLI.
2521

2622
```bash
27-
npm install -g fern-api
28-
fern check
23+
npm install -g fern-api # Installs CLI
24+
fern check # Checks if the definition is valid
2925
```
3026

3127
## What are Generators?
3228

33-
A generator reads in your API Definition and outputs files. The generated files are then pushed to a GitHub repo.
34-
35-
The list of enabled generators is in [generators.yml](./fern/api/generators.yml).
36-
37-
For example, the TypeScript generator creates the TypeScript SDK. Fern pushes the generated files to [raven-node](https://github.com/ravenappdev/raven-node) and tags a release on that repo. This triggers a GitHub action on the [raven-node](https://github.com/ravenappdev/raven-node) repo, which compiles and publishes the package to npm.
29+
Generators read in your API Definition and output files or code (i.e. the TypeScript SDK Generator) and are tracked in [generators.yml](./fern/api/generators.yml).
3830

39-
The generators are invoked by running `fern release`. When you tag a release on this repo, there's a [GitHub action](.github/workflows/ci.yml#L31) that runs `fern release`.
40-
41-
## How do I make changes to the API?
42-
43-
1. Clone this repo
44-
1. Install fern: `npm install -g fern-api`
45-
1. Edit the [API Definition](fern/api/definition)
46-
1. You can run `fern check` to check for issues
47-
1. Make a PR to this repo
48-
1. If checks pass, merge the PR in
49-
1. When you're ready to release new versions of your SDKs, just tag a release on this repo
31+
To trigger the generators run:
5032

33+
```bash
34+
fern release <version>
35+
```
5136

37+
This command currently runs in a GitHub workflow (see [ci.yml](.github/workflows/ci.yml#L32))

fern/api/definition/api.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ auth: AuthKey
33
auth-schemes:
44
AuthKey:
55
header: Authorization
6-
# origin: https://api.ravenapp.dev
6+
environments:
7+
Prod: https://api.ravenapp.dev
8+
default-environment: Prod

fern/api/definition/ids.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json
2+
13
types:
24
AppId: string
35
UserId: string

fern/api/generators.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
release:
22
- name: fernapi/fern-typescript-sdk
3-
version: 0.0.209
3+
version: 0.0.219
44
publishing:
55
npm:
6-
package-name: "@fern-api/raven" # TODO: should be published under Raven's NPM org
6+
package-name: '@fern-api/raven' # TODO: should be published under Raven's NPM org
77
token: ${FERN_NPM_TOKEN} # TODO: should use Raven's NPM Token
88
github:
9-
repository: fern-api/raven-node
9+
repository: ravenappdev/raven-node
10+
- name: fernapi/fern-java-sdk
11+
version: 0.0.121
12+
publishing:
13+
maven:
14+
coordinate: io.github.fern-api:raven
15+
username: ${FERN_MAVEN_USERNAME} # TODO: should be published under Raven's Maven account
16+
password: ${FERN_MAVEN_TOKEN}
17+
github:
18+
repository: ravenappdev/raven-java

fern/fern.config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"organization": "raven",
3-
"version": "0.0.214"
3+
"version": "0.0.221"
44
}

0 commit comments

Comments
 (0)