perseid 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,8 @@
6
6
 
7
7
  perseid generates Rust, TypeScript, Python, Go, Java and C# SDKs. When the spec changes, a GitHub
8
8
  Action regenerates them, opens a pull request, and releases them to their registries once you
9
- merge. It is one static binary. There is no hosted service, no account and no subscription.
9
+ merge. It is one static binary, run in your CI. No account and no subscription: the perseid
10
+ GitHub App only lends the workflows short-lived tokens, so no secret is stored.
10
11
 
11
12
  ## Why perseid
12
13
 
@@ -20,20 +21,25 @@ merge. It is one static binary. There is no hosted service, no account and no su
20
21
 
21
22
  ## Quick start
22
23
 
23
- In the repository that holds your OpenAPI spec:
24
+ perseid runs from the repository that holds your OpenAPI spec, so every change to the spec
25
+ regenerates the SDKs. The SDKs can live there or in their own repositories.
24
26
 
25
27
  ```sh
26
- npx perseid init # pick the languages and where the SDKs live
27
- gh secret set SDK_GITHUB_TOKEN # paste a fine-grained token, see below
28
- git add -A && git commit -m "ci: generate SDKs with perseid" && git push
28
+ npx perseid init # pick the languages and where the SDKs live (this repo or others)
29
+ npx perseid sync # install the perseid App on this repository and the SDK repositories
29
30
  ```
30
31
 
31
- The push runs the `SDKs` workflow, which opens a pull request with every SDK.
32
+ Commit and push what perseid wrote: the `SDKs` workflow then opens a pull request with every SDK.
32
33
 
33
- `SDK_GITHUB_TOKEN` is a [fine-grained token](https://github.com/settings/personal-access-tokens/new)
34
- with **Contents**, **Pull requests** and **Workflows** set to read and write, on this repository
35
- and the SDK repositories. Fine-grained tokens expire, and perseid warns 30 days before.
36
- `npx perseid app` sets up a GitHub App instead, which doesn't expire.
34
+ Rather keep perseid out of your API repository? Run it from a
35
+ [separate SDKs repository](docs/ci.md#a-separate-sdks-repository) that your API repo pushes the
36
+ spec to.
37
+
38
+ The [perseid App](https://github.com/apps/perseid-sdks) has Contents and Pull requests access to
39
+ the repositories you select. Each run
40
+ trades its GitHub OIDC token for an App token covering its repositories for an hour, so nothing
41
+ is stored. Rather keep the key yourself? `npx perseid app` creates a GitHub App of your own, or
42
+ set a [fine-grained token](docs/ci.md#tokens) as the `SDK_GITHUB_TOKEN` secret.
37
43
 
38
44
  To see the SDKs before pushing anything:
39
45
 
@@ -92,16 +98,19 @@ var pets = await petstore.Pets.ListAsync(new() { Limit = 10, Status = PetStatus.
92
98
  sdk-release.yml ─ release-please PR ← you merge ─ tag ─ publish to npm, PyPI, crates.io…
93
99
  ```
94
100
 
95
- `perseid init` writes two workflows for you to commit:
101
+ `perseid init` and `perseid sync` write three workflows, with your own credentials:
96
102
 
97
103
  - `sdks.yml` runs the `meteroid-oss/perseid` Action when the spec changes. It installs perseid
98
104
  and the pinned formatters, then runs `perseid generate --pr`, which commits the SDKs to the
99
105
  `perseid/update` branch and opens or updates one pull request per repository.
100
- - `sdk-release.yml` runs release-please on merge and publishes each released SDK from the
101
- `release` environment.
106
+ - `sdk-ci.yml`, in each repository holding SDKs, builds each SDK and runs its tests on pull
107
+ requests and pushes.
108
+ - `sdk-release.yml`, in each repository holding SDKs, runs release-please on merge and publishes
109
+ each released SDK from the `release` environment.
102
110
 
103
- The Actions are pinned to the release line of the perseid that wrote them, such as
104
- `meteroid-oss/perseid@v0.6`. Run `perseid init` again to refresh them.
111
+ `sdks.yml` is pinned to the release line of the perseid that wrote it, such as
112
+ `meteroid-oss/perseid@v0.6`: run `perseid init` again to refresh it. `sdk-ci.yml` and
113
+ `sdk-release.yml` follow `@v0`, so they rarely change.
105
114
 
106
115
  ## Where the SDKs live
107
116
 
@@ -113,11 +122,12 @@ The Actions are pinned to the release line of the perseid that wrote them, such
113
122
  | One repository per language | `repo = "acme/api-{lang}"` | `acme/api-typescript`, `acme/api-python` |
114
123
  | One SDKs repository | `repo = "acme/api-sdks"` | `acme/api-sdks`, a folder per language |
115
124
 
116
- - perseid never creates repositories: `gh repo create acme/api-typescript`.
117
- - Add `SDK_GITHUB_TOKEN` to each SDK repository too: its release workflow uses it.
118
- - Spec in another repository? Run `perseid init` in the SDKs repository, then
125
+ - perseid never creates repositories: `gh repo create acme/api-typescript`, then `perseid sync`
126
+ installs the App there and commits its CI and release workflows.
127
+ - Spec in another repository? Run `perseid init` and `perseid sync` in the SDKs repository, then
119
128
  `npx perseid connect acme/api-sdks` in the API repository. It writes a workflow pushing the
120
- spec, as the App of `perseid app` or with a token.
129
+ spec, and opens a pull request naming the API repository as the `source` of `perseid.toml`:
130
+ the API repository needs no App and no secret.
121
131
  - A spec served at a URL needs no `connect`: `sdks.yml` fetches it daily.
122
132
 
123
133
  See [repository layouts](docs/ci.md#repository-layouts).
@@ -128,8 +138,9 @@ See [repository layouts](docs/ci.md#repository-layouts).
128
138
  |---|---|
129
139
  | `init` | Write `perseid.toml` and the workflows. Local only: nothing is sent to GitHub. |
130
140
  | `generate` | Write the SDKs. `--out <dir>` previews, `--check` fails on drift, `--pr` opens pull requests. |
141
+ | `sync` | Install the perseid App on the repositories `perseid.toml` names, and commit their release workflow. |
131
142
  | `connect <owner/repo>` | In the API repository: push the spec to the SDKs repository. |
132
- | `app` | Set up a GitHub App to open the pull requests instead of `SDK_GITHUB_TOKEN`. |
143
+ | `app` | Set up a GitHub App of your own instead of the perseid App. |
133
144
  | `status` | Check the setup: secrets, workflows, last spec pushed, open pull requests, last runs. |
134
145
  | `inspect` | Print the model the templates receive, as JSON. |
135
146
  | `eject <lang>` | Copy the built-in templates and runtime of a language to `.perseid/` to edit them. |
package/checksums.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "perseid-aarch64-apple-darwin.tar.gz": "fe9aafd26554d3d13acc2bce0c5c6888d704886da615aa0f4481195849b229aa",
3
- "perseid-aarch64-unknown-linux-musl.tar.gz": "52d8da3778f3724575538d4097615176be8ae29d696c99aa8a1d6ae453939b81",
4
- "perseid-x86_64-apple-darwin.tar.gz": "1f912dda16fd7a6a7f20bb1143c166e34f425bdcd50144f25a697d7b0ac9bb61",
5
- "perseid-x86_64-unknown-linux-musl.tar.gz": "965235913d83116251993a424cb1791d09bdac84b6a2ba0b29f6568b0a330c01"
2
+ "perseid-aarch64-apple-darwin.tar.gz": "aaff05fb66afb88dbbdd17d372369ce9389d5d5e9cc3549db3eff86b973ce8b6",
3
+ "perseid-aarch64-unknown-linux-musl.tar.gz": "dfe0af436d54373b979999b2f0fc50b2ac96c17188a27f3f6b8591608af3e63e",
4
+ "perseid-x86_64-apple-darwin.tar.gz": "045f9101526d430cf48f56a22194d125a7b273618c6e25b0136fb88ab9c00ff4",
5
+ "perseid-x86_64-unknown-linux-musl.tar.gz": "3b7e63da153081621184236d3327f1076a169784a1b2f0796208b8b422e83e1a"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perseid",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "OpenAPI in, idiomatic SDKs out: Rust, TypeScript, Python, Go, Java and C# from one static binary",
5
5
  "keywords": [
6
6
  "openapi",