@opensoftware/contracts 2.0.0 → 2.1.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
@@ -91,18 +91,41 @@ the workflow by hand with the tag. The CONTRACT check and `osf-contracts breakin
91
91
  Only the TypeScript package exists (ADR 0012). A client for another language can be generated from
92
92
  `openapi/openapi.json` with any OpenAPI generator when someone needs one.
93
93
 
94
+ A new package gets its publish workflow and its release-please entries with `osf release-files`; the check RELEASE
95
+ fails until they are current, and also when a workflow differs from `tools/scaffold/publish-workflow.yml`.
96
+
94
97
  One-time setup (no credential is ever stored in the repository):
95
98
 
96
99
  1. npm: the organization `opensoftware` owns the scope `@opensoftware`, under which every package of this
97
100
  repository is published.
98
101
  2. GitHub: the publish job runs in the environment `npm` (Settings → Environments; GitHub creates it on the first
99
102
  run).
100
- 3. First version only: npm configures trusted publishing per existing package, so `1.0.0` needs a token. Add a
101
- granular npm access token with read and write access to the `opensoftware` organization's packages as the
102
- secret `NPM_TOKEN` (a repository secret or a secret of the environment `npm`), or publish `1.0.0` by hand.
103
- 4. After the first version: on npmjs.com, package settings → Trusted publishing, add GitHub Actions with the
104
- repository `sesigl/open-software-factory`, the workflow `publish-contracts.yml` and the environment `npm`.
105
- Then delete the secret `NPM_TOKEN` and revoke the token. Later versions publish through OIDC only.
103
+ 3. First version only: npm adds a trusted publisher only to a package that exists, so a maintainer publishes the
104
+ first version by hand, from the release tag, with their own npm login and two-factor authentication:
105
+ `pnpm --filter "<package>..." build`, `pnpm --dir <folder> pack`, then `npm publish <file>.tgz --access public`.
106
+ 4. Then add the trusted publisher, on npmjs.com (package settings → Trusted publishing) or with
107
+ `npm trust github <package> --file publish-<name>.yml --repository sesigl/open-software-factory --environment npm
108
+ --allow-publish --allow-stage-publish`. Every later version publishes through OIDC only, with a provenance
109
+ statement; the repository holds no npm token.
110
+
111
+ An agent can do step 4 and the checks below with the npm CLI (11.19 or later). It needs a maintainer's
112
+ `npm login --registry https://registry.npmjs.org`. Every `npm trust` call needs two-factor authentication, also
113
+ `list`. Without a terminal, the call fails with `EOTP` and prints an `authUrl` and a `doneUrl`. The maintainer
114
+ opens the `authUrl` and approves. Then a `GET` of the `doneUrl`, with the login's token as a bearer token, returns
115
+ a `token`. The agent passes it as `--otp=<token>` to the next `npm trust` calls; it stays valid for some minutes.
116
+
117
+ To check all packages, run `npm trust list <package>` for each `publish-*.yml` that publishes to npm. Each package
118
+ has exactly one entry: this repository, its own workflow file, the environment `npm`, and the permissions
119
+ `createPackage` and `createStagedPackage`.
120
+
121
+ When a publish fails with `E404 Not Found - PUT https://registry.npmjs.org/@opensoftware%2f<name>`:
122
+
123
+ - npm did not accept the job as a trusted publisher. Check that the job has `id-token: write` and
124
+ `environment: npm`, and compare the package's entry with the rule above.
125
+ - An entry can look correct and still fail. Then remove it with `npm trust revoke <package> --id=<id>`, add it
126
+ again with step 4 and run the workflow again with the tag.
127
+ - After a successful publish, npm can take some minutes before the version is available. A build that installs
128
+ the new version in this time fails with `ETARGET`; run it again.
106
129
 
107
130
  ## Configuration
108
131
 
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Open Software Factory contracts",
5
- "version": "2.0.0",
5
+ "version": "2.1.0",
6
6
  "description": "The shared formats as named models, and the HTTP APIs of the modules. Generated by `pnpm build` in contracts/ from typespec/. Do not edit.",
7
7
  "license": {
8
8
  "name": "Apache-2.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensoftware/contracts",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "The shared formats of the open software factory: JSON Schemas, TypeScript types and the osf-contracts CLI.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -44,7 +44,7 @@
44
44
  "@typespec/openapi": "1.17.0",
45
45
  "@typespec/openapi3": "1.17.0",
46
46
  "openapi-typescript": "7.13.0",
47
- "@opensoftware/testkit": "0.28.0"
47
+ "@opensoftware/testkit": "0.30.0"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "node scripts/build.ts",