Skip to content

Commit 82f16e1

Browse files
authored
Merge pull request #85 from taras/docs/publishing
docs: publishing @executablemd packages via OIDC
2 parents b57b2a0 + 6aed8a3 commit 82f16e1

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

‎.github/PUBLISHING.md‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Publishing `@executablemd` packages
2+
3+
Pushing a `vX.Y.Z` tag runs two workflows: `release.yml` compiles the `xmd`
4+
binaries, and `publish-packages.yml` publishes every `@executablemd/*` library
5+
to npm (primary) and JSR (secondary). `publish-packages.yml` is generated from
6+
the manifests by `scripts/gen-publish-workflow.ts` and calls the reusable
7+
`publish-one.yml` once per package, ordered by `needs:` so dependencies publish
8+
before dependents. `publish-packages.yml` also runs manually via
9+
`workflow_dispatch` with a `tag` input.
10+
11+
## Packages
12+
13+
- `@executablemd/durable-streams`
14+
- `@executablemd/runtime`
15+
- `@executablemd/code-review-agent`
16+
- `@executablemd/core`
17+
- `@executablemd/cli`
18+
19+
## npm authentication (OIDC, no token)
20+
21+
`publish-one.yml` authenticates to npm with GitHub Actions OIDC trusted
22+
publishing; the repo holds no npm token. Each package has a trusted publisher
23+
configured at npmjs.com → the package → **Settings → Trusted Publisher →
24+
GitHub Actions**:
25+
26+
| Field | Value |
27+
| -------------------- | ----------------------- |
28+
| Organization or user | `taras` |
29+
| Repository | `executable.md` |
30+
| Workflow filename | `publish-packages.yml` |
31+
| Environment name | _(empty)_ |
32+
| Allowed actions | `npm publish` |
33+
34+
The workflow filename is the **calling** workflow (`publish-packages.yml`), not
35+
the reusable `publish-one.yml`: for `workflow_call` / `workflow_dispatch`, npm
36+
validates the caller's filename.
37+
38+
The npm account owns the `@executablemd` scope, and packages publish public
39+
(`npm publish --access public`).
40+
41+
## Adding a new package
42+
43+
npm exposes trusted-publisher settings only on a package that already exists, and
44+
the workflow carries no npm token, so a brand-new package is bootstrapped by hand
45+
once:
46+
47+
1. Make it a workspace member: add its directory to `workspace` in the root
48+
`deno.json`, give it a `deno.json` whose `name` is under `@executablemd`, and
49+
a `package.json` declaring its dependencies (`workspace:*` for internal
50+
`@executablemd` siblings). `gen-publish-workflow.ts` then picks it up
51+
automatically — run `deno task gen:publish-workflow` and commit the result
52+
(CI fails if `publish-packages.yml` is stale).
53+
2. Publish its first version by hand, as a maintainer who is logged in to npm
54+
(`npm login`) and owns the `@executablemd` scope:
55+
```sh
56+
deno run -A scripts/build-npm.ts <package-dir> <version>
57+
( cd <package-dir>/npm && npm publish --access public )
58+
```
59+
3. Configure the trusted publisher on the now-existing package with the table
60+
above.
61+
4. Optionally create/link the package on jsr.io (JSR is best-effort and does not
62+
fail the run).
63+
64+
Every later release publishes the package automatically over OIDC.
65+
66+
## Consumer note
67+
68+
`@executablemd/core`, `@executablemd/runtime`, and `@executablemd/cli` depend on
69+
effection's 4.x prerelease, which npm's peer resolver rejects against
70+
`@effectionx/*` (`^3 || ^4`). Installing them needs `--legacy-peer-deps` until
71+
effection 4 is stable.

0 commit comments

Comments
 (0)