You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Adding-a-New-API-Version.md
+45-22Lines changed: 45 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
**Document Purpose**: Step-by-step guide for adding support for a new API version (e.g., `v20300101`) to the mx-platform-node repository.
4
4
5
-
**Last Updated**: January 27, 2026
5
+
**Last Updated**: January 28, 2026
6
6
**Time to Complete**: 30-45 minutes
7
7
**Prerequisites**: Familiarity with the multi-version architecture (see [Multi-Version-SDK-Flow.md](Multi-Version-SDK-Flow.md))
8
8
@@ -146,7 +146,7 @@ This ensures when multiple versions are generated, changelog entries appear in o
146
146
147
147
### 2.3 Update on-push-master.yml
148
148
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.
150
150
151
151
**Location 1: Path trigger**
152
152
@@ -164,34 +164,56 @@ on:
164
164
165
165
This ensures the workflow triggers when changes to your version directory are pushed to master.
166
166
167
-
**Location 2: Publish job matrix**
167
+
**Location 2: Add publish job for new version**
168
168
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):
170
170
171
171
```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
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
32
34
33
35
**When**: OpenAPI repository sends `repository_dispatch` with API versions
34
36
**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
36
42
37
43
**Key Details**: See [Workflow-and-Configuration-Reference.md](Workflow-and-Configuration-Reference.md#flow-1-automatic-multi-version-generation-repository-dispatch)
Developer runs `generate.yml` → SDK generated in feature branch → PR created → code review & approval → merge to master → `on-push-master.yml` publishes and releases
41
47
42
48
**When**: Developer clicks "Run workflow" on `generate.yml`
43
49
**Who**: Developer (controls version selection and bump strategy)
44
50
**Inputs**:
45
51
-`api_version`: Choose `v20111101` or `v20250224`
46
52
-`version_bump`: Choose `skip`, `minor`, or `patch`
47
53
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
49
61
50
62
**Key Details**: See [Workflow-and-Configuration-Reference.md](Workflow-and-Configuration-Reference.md#flow-2-manual-multi-version-generation-workflow-dispatch)
51
63
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
-
61
64
---
62
65
63
66
## Visual Flows
@@ -68,28 +71,27 @@ Changes pushed to `v20111101/**` or `v20250224/**` → `on-push-master.yml` runs
68
71
sequenceDiagram
69
72
participant OpenAPI as OpenAPI<br/>Repository
70
73
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
72
77
participant npm as npm<br/>Registry
73
78
participant GHRel as GitHub<br/>Releases
74
79
75
80
OpenAPI->>GH: Changes to v20111101.yml<br/>and v20250224.yml<br/>(repository_dispatch)
76
81
GH->>+Gen: Trigger workflow
77
82
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
79
84
deactivate Gen
80
85
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
93
95
```
94
96
95
97
### Manual Flow
@@ -100,7 +102,8 @@ sequenceDiagram
100
102
participant GH as GitHub<br/>Actions
101
103
participant Gen as generate.yml
102
104
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
104
107
participant npm as npm
105
108
participant GHRel as GitHub
106
109
@@ -110,44 +113,16 @@ sequenceDiagram
110
113
deactivate Gen
111
114
112
115
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
119
124
```
120
125
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
-
151
126
---
152
127
153
128
## Common Tasks
@@ -175,9 +150,9 @@ sequenceDiagram
175
150
|------|---------|---------|
176
151
|`.github/workflows/openapi-generate-and-push.yml`| Automatic generation from upstream API changes | OpenAPI repo |
177
152
|`.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 |
|`.github/version.rb`| Bumps version in config files | Workflows |
182
157
|`.github/clean.rb`| Removes old generated files | Workflows |
183
158
|`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:
215
190
216
191
| Feature | What It Does | When It Helps |
217
192
|---------|-------------|--------------|
193
+
|**Serial publishing**| Each version publishes sequentially to npm (v20111101 then v20250224) | Prevents npm registry conflicts and race conditions |
218
194
|**Path-based triggers**| Only publish if `v20111101/**` or `v20250224/**` changed | Prevents false publishes from doc-only changes |
219
195
|**[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 |
221
197
|**Version validation**| Major version must match API version | Prevents semantic versioning violations |
222
198
|**Config file validation**| Workflow fails if config doesn't exist | Catches typos early |
223
199
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.
Copy file name to clipboardExpand all lines: docs/Troubleshooting-Guide.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -259,7 +259,7 @@ fatal: A release with this tag already exists
259
259
```
260
260
4. If not present, update workflow from latest template
261
261
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.
0 commit comments