Skip to content

Commit 16d244e

Browse files
committed
Document process of adding new workflow/action to the release flow
1 parent 48c4b0b commit 16d244e

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,77 @@ uses: FlowFuse/github-actions-workflows/.github/workflows/build_container_image.
105105
# Composite actions use the same pattern:
106106
uses: FlowFuse/github-actions-workflows/actions/npm_test@npm_test/v1
107107
```
108+
109+
### Adding a New Reusable Workflow or Composite Action
110+
111+
When introducing a new component, it must be registered with Release Please
112+
so that it is versioned and tagged independently like the existing ones.
113+
114+
1. **Create the workflow or action file.**
115+
116+
* Reusable workflow: place the YAML file at
117+
`.github/workflows/<name>.yml`.
118+
* Composite action: create the directory `actions/<name>/` and add its
119+
`action.yml` (plus any supporting files).
120+
* `<name>` must be unique across **all** workflows and actions — the
121+
two share a flat tag namespace.
122+
123+
2. **Register the component in `.github/release-please-config.json`**
124+
by adding a new entry under `packages`.
125+
126+
* For a reusable workflow:
127+
128+
```json
129+
".github/workflows/<name>": {
130+
"component": "<name>",
131+
"include-paths": [".github/workflows/<name>.yml"]
132+
}
133+
```
134+
135+
The package key is a virtual path (no directory is created on
136+
disk); `include-paths` scopes change detection to the single YAML
137+
file.
138+
139+
* For a composite action:
140+
141+
```json
142+
"actions/<name>": {
143+
"component": "<name>"
144+
}
145+
```
146+
147+
The package key is the action's real directory; `include-paths` is
148+
not needed because any file under that directory is attributed to
149+
the component.
150+
151+
3. **Seed the initial version in `.github/release-please-manifest.json`**
152+
using the same key chosen in the previous step:
153+
154+
```json
155+
"<path-used-above>": "1.0.0"
156+
```
157+
158+
4. **Open the pull request with a Conventional Commit title**, for
159+
example `feat: add <name> reusable workflow`.
160+
161+
5. **After merging the pull request, bootstrap the initial tags** for
162+
the new component. They must exist before consumers can reference it
163+
and before Release Please runs cleanly for the new entry:
164+
165+
```bash
166+
git fetch origin main
167+
SHA=$(git rev-parse origin/main)
168+
NAME="<name>"
169+
git tag "${NAME}/v1.0.0" "${SHA}"
170+
git tag "${NAME}/v1.0" "${SHA}"
171+
git tag "${NAME}/v1" "${SHA}"
172+
git push origin "${NAME}/v1.0.0" "${NAME}/v1.0" "${NAME}/v1"
173+
```
174+
175+
> If Release Please happens to run between the merge and this
176+
> bootstrap (it triggers on every push to `main`), it may open a
177+
> stray release pull request proposing an inflated first version for
178+
> the new component, because it has no tag to use as a baseline.
179+
> Simply close that pull request — the next Release Please run, once
180+
> the bootstrap tags exist, will be a no-op for the new component.
181+

0 commit comments

Comments
 (0)