@appshell/cli 1.0.0-alpha.100 → 1.0.0-alpha.101

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
@@ -50,6 +50,8 @@ Commands:
50
50
  appshell logout Discard the stored credential for a registry
51
51
  appshell publish Publish a package to the appshell registry
52
52
  appshell unpublish <name> <version> Remove a published package version
53
+ appshell trust Trust CI workflows to publish into a scope
54
+ without a stored secret
53
55
  appshell outdated Analyzes shared dependencies for outdated versions
54
56
  ```
55
57
 
@@ -92,7 +94,8 @@ appshell logout
92
94
 
93
95
  The token is stored per registry. A registry running `AUTH_MODE=none` needs none —
94
96
  commands only fail when the registry says so, and a 401 tells you to log in.
95
- `APPSHELL_TOKEN` overrides the stored credential.
97
+ `APPSHELL_TOKEN` overrides the stored credential. A GitHub Actions job can publish with
98
+ neither — see [Trusted publishing](#trusted-publishing).
96
99
 
97
100
  ## Publishing a package
98
101
 
@@ -116,6 +119,51 @@ forcing. When `--application` resolves, publish also **activates** the version t
116
119
  appshell unpublish checkout 1.5.0
117
120
  ```
118
121
 
122
+ ## Trusted publishing
123
+
124
+ A GitHub Actions workflow can publish into a scope with its own OIDC identity, so no
125
+ secret is stored anywhere. The scope's owner — or an organization admin, for a scope an
126
+ organization owns — records which workflow may:
127
+
128
+ ```bash
129
+ appshell trust add acme --github acme/widgets --workflow pipeline.yml --environment production
130
+ appshell trust list acme
131
+ appshell trust remove acme 1b2c3d4e # the id as `list` shows it
132
+ ```
133
+
134
+ `trust add` looks the repository up on GitHub and records it by its immutable ids, so a
135
+ renamed or transferred repository, or a new one taking the old name, does not inherit the
136
+ trust. Set `GITHUB_TOKEN` (or `GH_TOKEN`) to look up a private repository; `--github-api
137
+ https://<host>/api/v3` and `--issuer` cover GitHub Enterprise Server. Naming an
138
+ `--environment` is recommended: its protection rules then decide which branches and
139
+ reviewers can publish.
140
+
141
+ The workflow needs `id-token: write` and the registry's address, nothing else:
142
+
143
+ ```yaml
144
+ permissions: { id-token: write, contents: read }
145
+ env: { APPSHELL_REGISTRY: https://registry.appshell.org }
146
+ jobs:
147
+ publish:
148
+ runs-on: ubuntu-latest
149
+ environment: production
150
+ steps:
151
+ - uses: actions/checkout@v4
152
+ # ...build...
153
+ - run: npx appshell publish
154
+ ```
155
+
156
+ With no `APPSHELL_TOKEN` and no stored login for the registry, `appshell publish` asks the
157
+ runner for a token whose audience is the registry url as configured, without a trailing
158
+ slash — the registry's `TRUSTED_PUBLISHING_AUDIENCE` must be exactly that — and presents
159
+ it for that one request. Each publish mints its own and none is stored. An explicit
160
+ `APPSHELL_TOKEN` or stored login wins, so a job that sets one publishes as that account.
161
+
162
+ The package must name its scope, as `@acme/widgets`: a workflow has no namespace of its
163
+ own. A refusal says what to check — `appshell trust list <scope>` and the job's
164
+ environment, or that the registry does not have trusted publishing enabled, in which case
165
+ publish retries once without a token for a registry that needs none (`AUTH_MODE=none`).
166
+
119
167
  ## Declaring an application
120
168
 
121
169
  `appshell app apply` reconciles an application against a declared resource, creating