Skip to content

Commit a932caa

Browse files
author
Genevieve Nuebel
committed
Re-audit of docs and so many updates
1 parent 301478f commit a932caa

4 files changed

Lines changed: 206 additions & 127 deletions

File tree

docs/Adding-a-New-API-Version.md

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**Document Purpose**: Step-by-step guide for adding support for a new API version (e.g., `v20300101`) to the mx-platform-node repository.
44

5-
**Last Updated**: January 27, 2026
5+
**Last Updated**: January 28, 2026
66
**Time to Complete**: 30-45 minutes
77
**Prerequisites**: Familiarity with the multi-version architecture (see [Multi-Version-SDK-Flow.md](Multi-Version-SDK-Flow.md))
88

@@ -146,7 +146,7 @@ This ensures when multiple versions are generated, changelog entries appear in o
146146

147147
### 2.3 Update on-push-master.yml
148148

149-
This workflow automatically triggers publish and release jobs when version directories are pushed to master.
149+
This workflow automatically triggers publish and release jobs when version directories are pushed to master. Since individual version jobs use conditional `if` statements based on path changes, you need to add new conditional jobs for your new version.
150150

151151
**Location 1: Path trigger**
152152

@@ -164,34 +164,56 @@ on:
164164

165165
This ensures the workflow triggers when changes to your version directory are pushed to master.
166166

167-
**Location 2: Publish job matrix**
167+
**Location 2: Add publish job for new version**
168168

169-
In the `publish` job's strategy matrix, add your version entry:
169+
Add a new publish job for your version (copy and modify the existing v20250224 jobs):
170170

171171
```yaml
172-
strategy:
173-
matrix:
174-
version:
175-
- api_version: v20111101
176-
- api_version: v20250224
177-
- api_version: v20300101 # NEW
178-
fail-fast: false
172+
publish-v20300101:
173+
runs-on: ubuntu-latest
174+
needs: [check-skip-publish, gate-v20250224-complete] # Gate waits for previous version
175+
if: needs.check-skip-publish.outputs.skip_publish == 'false' && contains(github.event.head_commit.modified, 'v20300101')
176+
uses: ./.github/workflows/publish.yml@master
177+
with:
178+
version_directory: v20300101
179+
secrets: inherit
179180
```
180181

181-
**Location 3: Release job matrix**
182+
**Location 3: Add release job for new version**
182183

183-
In the `release` job's strategy matrix, add your version entry (mirror the publish matrix):
184+
Add a new release job for your version:
184185

185186
```yaml
186-
strategy:
187-
matrix:
188-
version:
189-
- api_version: v20111101
190-
- api_version: v20250224
191-
- api_version: v20300101 # NEW
192-
fail-fast: false
187+
release-v20300101:
188+
runs-on: ubuntu-latest
189+
needs: [check-skip-publish, publish-v20300101]
190+
if: needs.check-skip-publish.outputs.skip_publish == 'false' && contains(github.event.head_commit.modified, 'v20300101')
191+
uses: ./.github/workflows/release.yml@master
192+
with:
193+
version_directory: v20300101
194+
secrets: inherit
193195
```
194196

197+
**Location 4: Add gate job for previous version**
198+
199+
Add a new gate job after the previous version's release to handle serial ordering:
200+
201+
```yaml
202+
gate-v20250224-complete:
203+
runs-on: ubuntu-latest
204+
needs: [check-skip-publish, release-v20250224]
205+
if: always() && needs.check-skip-publish.outputs.skip_publish == 'false'
206+
steps:
207+
- name: Gate complete - ready for v20300101
208+
run: echo "v20250224 release workflow complete (or skipped)"
209+
```
210+
211+
**Important Notes**:
212+
- Each publish job depends on the **previous version's gate job** to maintain serial ordering
213+
- Each release job depends on its corresponding publish job
214+
- Gate jobs use the `always()` condition so they run even when intermediate jobs are skipped
215+
- This prevents npm registry race conditions and ensures correct behavior whether one or multiple versions are modified
216+
195217
### 2.4 Verify Workflow Syntax
196218

197219
Check that your YAML is valid for all three modified files:
@@ -367,8 +389,9 @@ Use this checklist to verify you've completed all steps:
367389
- [ ] Updated `.github/workflows/openapi-generate-and-push.yml` with version-to-config mapping in Setup job
368390
- [ ] Updated `.github/changelog_manager.rb` with new version in `API_VERSION_ORDER` array
369391
- [ ] Updated `.github/workflows/on-push-master.yml` path triggers with `v20300101/**`
370-
- [ ] Updated `.github/workflows/on-push-master.yml` publish job matrix with new version
371-
- [ ] Updated `.github/workflows/on-push-master.yml` release job matrix with new version
392+
- [ ] Updated `.github/workflows/on-push-master.yml` with new publish job for v20300101
393+
- [ ] Updated `.github/workflows/on-push-master.yml` with new release job for v20300101
394+
- [ ] Updated `.github/workflows/on-push-master.yml` with new gate job for previous version (v20250224)
372395
- [ ] Verified workflow YAML syntax is valid for all three modified files
373396
- [ ] Updated root `README.md` with new API version table entry
374397
- [ ] Updated root `README.md` with installation example for new version

docs/Multi-Version-SDK-Flow.md

Lines changed: 50 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,47 @@ Each version is independently generated, tested, published to npm, and released
2020
1. **Separate Directories**: Each API version in its own directory (`v20111101/`, `v20250224/`)
2121
2. **Reusable Workflows**: `workflow_call` passes version info to publish/release jobs
2222
3. **One Config Per Version**: `config-v20111101.yml`, `config-v20250224.yml`, etc.
23-
4. **Matrix Parallelization**: All versions generate/publish simultaneously
23+
4. **Single Entrypoint for Publishing**: All paths lead through `on-push-master.yml` for serial, controlled publishing
2424
5. **Safety First**: Skip-publish flags and path-based triggers prevent accidents
2525

2626
---
2727

28-
## Three Ways Things Happen
28+
## Two Paths to Publishing
2929

30-
### 🤖 Flow 1: Automatic (Upstream Triggers)
31-
OpenAPI spec changes → `openapi-generate-and-push.yml` runs → SDK generated, published, released
30+
Both paths follow the same publishing mechanism: commit changes to master → `on-push-master.yml` handles serial publish/release.
31+
32+
### 🤖 Path 1: Automatic (Upstream Triggers)
33+
OpenAPI spec changes → `openapi-generate-and-push.yml` generates SDK → commits to master → `on-push-master.yml` publishes and releases
3234

3335
**When**: OpenAPI repository sends `repository_dispatch` with API versions
3436
**Who**: Automated, no human intervention
35-
**Result**: All specified versions generated in parallel, committed, published, released in single workflow
37+
**What Happens**:
38+
1. `openapi-generate-and-push.yml` generates all specified versions in parallel
39+
2. All generated files committed to master
40+
3. `on-push-master.yml` automatically triggered by the push
41+
4. `on-push-master.yml` handles serial publish/release with version gating
3642

3743
**Key Details**: See [Workflow-and-Configuration-Reference.md](Workflow-and-Configuration-Reference.md#flow-1-automatic-multi-version-generation-repository-dispatch)
3844

39-
### 👨‍💻 Flow 2: Manual (Developer Triggers)
40-
Developer runs `generate.yml` → SDK generated → PR created → Developer merges → Auto-publish triggers
45+
### 👨‍💻 Path 2: Manual (Developer Triggers)
46+
Developer runs `generate.yml` → SDK generated in feature branch → PR created → code review & approval → merge to master → `on-push-master.yml` publishes and releases
4147

4248
**When**: Developer clicks "Run workflow" on `generate.yml`
4349
**Who**: Developer (controls version selection and bump strategy)
4450
**Inputs**:
4551
- `api_version`: Choose `v20111101` or `v20250224`
4652
- `version_bump`: Choose `skip`, `minor`, or `patch`
4753

48-
**Result**: SDK generated in feature branch, PR created for review, auto-publishes on merge
54+
**What Happens**:
55+
1. `generate.yml` generates SDK in feature branch
56+
2. PR created for code review
57+
3. Developer (or team) reviews and approves
58+
4. PR merged to master
59+
5. `on-push-master.yml` automatically triggered by the merge
60+
6. `on-push-master.yml` handles serial publish/release with version gating
4961

5062
**Key Details**: See [Workflow-and-Configuration-Reference.md](Workflow-and-Configuration-Reference.md#flow-2-manual-multi-version-generation-workflow-dispatch)
5163

52-
### 🔄 Flow 3: Auto-Publish (Master Push)
53-
Changes pushed to `v20111101/**` or `v20250224/**``on-push-master.yml` runs → Publishes and releases
54-
55-
**When**: Any commit to master with version directory changes
56-
**Who**: Triggered automatically, can be skipped with `[skip-publish]` flag
57-
**Safety**: Only affected version(s) published (no cross-version interference)
58-
59-
**Key Details**: See [Workflow-and-Configuration-Reference.md](Workflow-and-Configuration-Reference.md#flow-3-auto-publish-trigger-with-path-based-matrix-execution-on-push-masteryml)
60-
6164
---
6265

6366
## Visual Flows
@@ -68,28 +71,27 @@ Changes pushed to `v20111101/**` or `v20250224/**` → `on-push-master.yml` runs
6871
sequenceDiagram
6972
participant OpenAPI as OpenAPI<br/>Repository
7073
participant GH as GitHub<br/>Actions
71-
participant Gen as generate_publish<br/>_release.yml
74+
participant Gen as openapi-generate-<br/>and-push.yml
75+
participant Push as Push to<br/>Master
76+
participant OnPush as on-push-<br/>master.yml
7277
participant npm as npm<br/>Registry
7378
participant GHRel as GitHub<br/>Releases
7479
7580
OpenAPI->>GH: Changes to v20111101.yml<br/>and v20250224.yml<br/>(repository_dispatch)
7681
GH->>+Gen: Trigger workflow
7782
Gen->>Gen: Matrix: Generate both versions<br/>in parallel
78-
Gen->>Gen: Commit to master<br/>Update CHANGELOG.md
83+
Gen->>Push: Commit to master<br/>Update CHANGELOG.md
7984
deactivate Gen
8085
81-
rect rgba(0, 255, 0, .1)
82-
note right of Gen: Parallel Publishing
83-
par publish v20111101
84-
npm->>npm: npm publish v2.0.1
85-
and publish v20250224
86-
npm->>npm: npm publish v3.0.1
87-
and release v20111101
88-
GHRel->>GHRel: Create tag v2.0.1
89-
and release v20250224
90-
GHRel->>GHRel: Create tag v3.0.1
91-
end
92-
end
86+
Push->>+OnPush: Push event triggers
87+
OnPush->>OnPush: Check skip-publish flag
88+
OnPush->>OnPush: Serial: v20111101 publish
89+
OnPush->>npm: npm publish v2.x.x
90+
OnPush->>GHRel: Create tag v2.x.x
91+
OnPush->>OnPush: Serial: v20250224 publish
92+
OnPush->>npm: npm publish v3.x.x
93+
OnPush->>GHRel: Create tag v3.x.x
94+
deactivate OnPush
9395
```
9496

9597
### Manual Flow
@@ -100,7 +102,8 @@ sequenceDiagram
100102
participant GH as GitHub<br/>Actions
101103
participant Gen as generate.yml
102104
participant Review as Code<br/>Review
103-
participant Auto as on-push-<br/>master.yml
105+
participant Merge as Merge to<br/>Master
106+
participant OnPush as on-push-<br/>master.yml
104107
participant npm as npm
105108
participant GHRel as GitHub
106109
@@ -110,44 +113,16 @@ sequenceDiagram
110113
deactivate Gen
111114
112115
Review->>Review: Review & Approve
113-
Review->>Review: Merge PR to master
114-
115-
GH->>+Auto: on-push-master.yml
116-
Auto->>npm: Publish selected version
117-
Auto->>GHRel: Create release
118-
deactivate Auto
116+
Review->>Merge: Merge PR to master
117+
118+
Merge->>+OnPush: Push event triggers
119+
OnPush->>OnPush: Check skip-publish flag
120+
OnPush->>OnPush: Serial: publish<br/>& release
121+
OnPush->>npm: npm publish
122+
OnPush->>GHRel: Create release
123+
deactivate OnPush
119124
```
120125

121-
### Auto-Publish Flow
122-
123-
```mermaid
124-
sequenceDiagram
125-
participant Push as Git Push
126-
participant Auto as on-push-<br/>master.yml
127-
participant skip as check-skip-<br/>publish
128-
participant pub as publish.yml
129-
participant rel as release.yml
130-
participant gate as gate-<br/>v20111101
131-
participant npm as npm
132-
participant GHRel as GitHub
133-
134-
Push->>+Auto: Push to master<br/>(v20111101/** changed)
135-
Auto->>skip: Check skip-publish flag
136-
skip-->>Auto: skip_publish: false
137-
Auto->>pub: publish-v20111101
138-
pub->>npm: npm publish v2.x.x
139-
Auto->>rel: release-v20111101
140-
rel->>GHRel: Create tag v2.x.x
141-
rel-->>gate: Release complete
142-
gate->>gate: Gate always runs<br/>(even if v20111101 skipped)
143-
note right of gate: Unblocks v20250224<br/>when only v20250224 changed
144-
gate-->>Auto: Gate complete
145-
Auto->>pub: publish-v20250224<br/>(skipped - not modified)
146-
deactivate Auto
147-
```
148-
149-
**Key Feature**: The `gate-v20111101-complete` job uses `always()` to run even when intermediate jobs are skipped, ensuring v20250224 can publish when only v20250224 is modified.
150-
151126
---
152127

153128
## Common Tasks
@@ -175,9 +150,9 @@ sequenceDiagram
175150
|------|---------|---------|
176151
| `.github/workflows/openapi-generate-and-push.yml` | Automatic generation from upstream API changes | OpenAPI repo |
177152
| `.github/workflows/generate.yml` | Manual generation with version selection | Developer |
178-
| `.github/workflows/on-push-master.yml` | Auto-publish trigger with path-based matrix | Any master push |
179-
| `.github/workflows/publish.yml` | Publishes SDK to npm | publish_release & on-push-master |
180-
| `.github/workflows/release.yml` | Creates GitHub release | publish_release & on-push-master |
153+
| `.github/workflows/on-push-master.yml` | Publishes and releases SDKs on master push | Both automatic & manual flows |
154+
| `.github/workflows/publish.yml` | Publishes SDK to npm | on-push-master |
155+
| `.github/workflows/release.yml` | Creates GitHub release | on-push-master |
181156
| `.github/version.rb` | Bumps version in config files | Workflows |
182157
| `.github/clean.rb` | Removes old generated files | Workflows |
183158
| `openapi/config-v20111101.yml` | Config for v20111101 generation | openapi-generate-and-push & generate |
@@ -215,12 +190,15 @@ If OpenAPI repo doesn't send new version in payload, the system doesn't break:
215190

216191
| Feature | What It Does | When It Helps |
217192
|---------|-------------|--------------|
193+
| **Serial publishing** | Each version publishes sequentially to npm (v20111101 then v20250224) | Prevents npm registry conflicts and race conditions |
218194
| **Path-based triggers** | Only publish if `v20111101/**` or `v20250224/**` changed | Prevents false publishes from doc-only changes |
219195
| **[skip-publish] flag** | Skip publish/release for this commit | During directory migrations or refactors |
220-
| **Matrix conditionals** | Each version publishes only if its path changed | Prevents unintended version bumps |
196+
| **Conditional jobs** | Each version's jobs only run if their paths changed | Prevents unintended version bumps |
221197
| **Version validation** | Major version must match API version | Prevents semantic versioning violations |
222198
| **Config file validation** | Workflow fails if config doesn't exist | Catches typos early |
223199

200+
**Note on Serial Publishing**: We chose explicit job sequences over matrix strategies to ensure safety. See [Workflow-and-Configuration-Reference.md - Architecture Decision section](Workflow-and-Configuration-Reference.md#architecture-decision-serial-publishing-with-conditional-jobs) for detailed reasoning.
201+
224202
---
225203

226204
## Environment Variables & Secrets

docs/Troubleshooting-Guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ fatal: A release with this tag already exists
259259
```
260260
4. If not present, update workflow from latest template
261261

262-
**Technical Details**: See [Workflow-and-Configuration-Reference.md](Workflow-and-Configuration-Reference.md#step-3-gate-job---unblock-v20250224-publishing) for full gate job implementation details.
262+
**Technical Details**: See [Workflow-and-Configuration-Reference.md](Workflow-and-Configuration-Reference.md#step-3-gate-job---unblock-v20250224-publishing) in the "Publishing via on-push-master.yml" section for full gate job implementation details.
263263

264264
---
265265

0 commit comments

Comments
 (0)