@bensandee/tooling 0.59.1 → 0.60.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
@@ -116,6 +116,7 @@ Opt out entirely with `"pnpmWorkspace": false` in `.tooling.json`; the generator
116
116
  | `tooling release:changesets` | Changesets version/publish for Forgejo CI. Flags: `--dry-run`, `--verbose`. Env: `FORGEJO_SERVER_URL`, `FORGEJO_REPOSITORY`, `RELEASE_TOKEN`. |
117
117
  | `tooling release:simple` | Streamlined release using commit-and-tag-version. Flags: `--release-as`, `--first-release`, `--prerelease`, `--verbose`. |
118
118
  | `tooling release:trigger` | Trigger a release workflow. |
119
+ | `tooling workflow:dispatch` | Dispatch a `workflow_dispatch` event for any workflow in any repo on the same git host. Flags: `--repo`, `--workflow` (required), `--ref`, `--input key=value` (repeatable). |
119
120
  | `tooling forgejo:create-release` | Create a Forgejo release from a tag. |
120
121
  | `tooling changesets:merge` | Merge a changesets version PR. |
121
122
  | `tooling webhook:send <url>` | POST a structured JSON release payload with HMAC-SHA256 auth. Flags: `--tag`, `--repository`, `--server-url`, `--actor`, `--prerelease`. Secret from `WEBHOOK_SECRET` env var. |
@@ -146,6 +147,40 @@ tooling release:simple --release-as major --prerelease beta # → 2.0.0-beta.0
146
147
 
147
148
  The generated release workflow exposes these as optional `workflow_dispatch` inputs (`bump` and `prerelease`), so bumps can also be controlled from the CI UI.
148
149
 
150
+ #### `workflow:dispatch`
151
+
152
+ Triggers a `workflow_dispatch` event for an arbitrary workflow in an arbitrary repo on the same git host — useful for release→deploy patterns where one repo's CI kicks off a workflow in another (e.g. an infra repo). `release:trigger` is a special case of this command, pinned to `release.yml` in the current repo.
153
+
154
+ ```bash
155
+ tooling workflow:dispatch \
156
+ --repo bensandee/ansible_infra \
157
+ --workflow deploy.yml \
158
+ --ref main \
159
+ --input stack=dirty_draft \
160
+ --input release_tag=v1.2.3
161
+ ```
162
+
163
+ On Forgejo it POSTs to the `actions/workflows/{workflow}/dispatches` API; on GitHub it shells out to `gh workflow run`. The token resolved from the environment / `package.json` must have rights on `--repo` when it differs from the current repo.
164
+
165
+ ##### Generated deploy step
166
+
167
+ For the common release→deploy case, `repo:sync` can generate the dispatch step for you. Add a `deploy` block to `.tooling.json`:
168
+
169
+ ```jsonc
170
+ {
171
+ "deploy": {
172
+ "dispatchRepo": "bensandee/ansible_infra", // required — repo whose workflow to trigger
173
+ "stack": "dirty_draft", // optional — defaults to the package name with '-' → '_'
174
+ "workflow": "deploy.yml", // optional — default "deploy.yml"
175
+ "ref": "main", // optional — default "main"
176
+ },
177
+ }
178
+ ```
179
+
180
+ When `deploy` is set, `repo:sync` appends a **"Dispatch deploy"** step to the release workflow (`release.yml` for the `simple` strategy, `ci.yml` for `changesets`). The step runs `bst workflow:dispatch` only after a successful release — gated on `steps.release.outputs.pushed` (simple) or `steps.release.outputs.published` (changesets) — and forwards the release tag as the `release_tag` input. `dispatchRepo` is deliberately explicit: a deploy target is never inferred. The `release-it` strategy does not support deploy dispatch (`repo:sync` warns and skips the step). The resolved release token must have rights on `dispatchRepo`; supply a separate cross-repo token by adding its secret name to `postReleaseHookSecrets`.
181
+
182
+ > **Note:** the `release_tag` input is sourced from the release step's `tag` output. On GitHub with the `changesets` strategy the release runs via `changesets/action`, which exposes no `tag` output — the deploy still fires, but `release_tag` is dispatched empty. The `simple` strategy and Forgejo `changesets` both populate it.
183
+
149
184
  #### Release assets
150
185
 
151
186
  Upload arbitrary build artifacts (tarballs, binaries, zips, etc.) to each release.