pipecraft 0.0.0-releaseit
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/.claude/settings.local.json +35 -0
- package/.github/actions/calculate-version/action.yml +106 -0
- package/.github/actions/create-pr/action.yml +122 -0
- package/.github/actions/create-release/action.yml +74 -0
- package/.github/actions/create-tag/action.yml +94 -0
- package/.github/actions/detect-changes/action.yml +62 -0
- package/.github/actions/manage-branch/action.yml +113 -0
- package/.github/actions/promote-branch/action.yml +352 -0
- package/.github/example/workflows/job.analyze.code.yml +26 -0
- package/.github/example/workflows/job.analyze.docker.yml +32 -0
- package/.github/example/workflows/job.app.api.deploy.yml +127 -0
- package/.github/example/workflows/job.app.api.test.yml +102 -0
- package/.github/example/workflows/job.app.docs.deploy.yml +40 -0
- package/.github/example/workflows/job.app.docs.test.yml +50 -0
- package/.github/example/workflows/job.app.web.deploy.yml +96 -0
- package/.github/example/workflows/job.app.web.test.yml +49 -0
- package/.github/example/workflows/job.changes.yml +82 -0
- package/.github/example/workflows/job.create-pr.yml +96 -0
- package/.github/example/workflows/job.env-check.yml +43 -0
- package/.github/example/workflows/job.fast-forward.yml +103 -0
- package/.github/example/workflows/job.lint.yml +64 -0
- package/.github/example/workflows/job.pr-name.yml +70 -0
- package/.github/example/workflows/job.pr-squash-name.yml +27 -0
- package/.github/example/workflows/job.tag.yml +38 -0
- package/.github/example/workflows/job.version.yml +99 -0
- package/.github/example/workflows/lib.plugin-base.publish.yml +59 -0
- package/.github/example/workflows/pipe.yml +178 -0
- package/.github/example/workflows/scripts/fastforward.sh +51 -0
- package/.github/example/workflows/scripts/pipe-cleaner.sh +70 -0
- package/.github/scripts/fastforward.sh +51 -0
- package/.github/scripts/pipe-cleaner.sh +70 -0
- package/.github/workflows/pipeline.yml +220 -0
- package/.github/workflows/pr-title-check.yml +70 -0
- package/.github/workflows/publish.yml +39 -0
- package/.pipecraftrc.json +78 -0
- package/.release-it.cjs +71 -0
- package/PIPELINE_TESTING_PLAN.md +499 -0
- package/README.md +1101 -0
- package/TRUNK_FLOW_PLAN.md +401 -0
- package/assets/logo_banner.png +0 -0
- package/assets/logo_banner.webp +0 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +364 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/generators/init.tpl.d.ts +3 -0
- package/dist/generators/init.tpl.d.ts.map +1 -0
- package/dist/generators/init.tpl.js +117 -0
- package/dist/generators/init.tpl.js.map +1 -0
- package/dist/generators/workflows.tpl.d.ts +7 -0
- package/dist/generators/workflows.tpl.d.ts.map +1 -0
- package/dist/generators/workflows.tpl.js +73 -0
- package/dist/generators/workflows.tpl.js.map +1 -0
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts +3 -0
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/calculate-version.yml.tpl.js +122 -0
- package/dist/templates/actions/calculate-version.yml.tpl.js.map +1 -0
- package/dist/templates/actions/create-pr.yml.tpl.d.ts +3 -0
- package/dist/templates/actions/create-pr.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/create-pr.yml.tpl.js +145 -0
- package/dist/templates/actions/create-pr.yml.tpl.js.map +1 -0
- package/dist/templates/actions/create-tag.yml.tpl.d.ts +3 -0
- package/dist/templates/actions/create-tag.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/create-tag.yml.tpl.js +111 -0
- package/dist/templates/actions/create-tag.yml.tpl.js.map +1 -0
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts +3 -0
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/detect-changes.yml.tpl.js +79 -0
- package/dist/templates/actions/detect-changes.yml.tpl.js.map +1 -0
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts +3 -0
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/manage-branch.yml.tpl.js +130 -0
- package/dist/templates/actions/manage-branch.yml.tpl.js.map +1 -0
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts +3 -0
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/promote-branch.yml.tpl.js +362 -0
- package/dist/templates/actions/promote-branch.yml.tpl.js.map +1 -0
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts +16 -0
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts.map +1 -0
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.js +652 -0
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.js.map +1 -0
- package/dist/types/index.d.ts +63 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/ast-path-operations.d.ts +287 -0
- package/dist/utils/ast-path-operations.d.ts.map +1 -0
- package/dist/utils/ast-path-operations.js +419 -0
- package/dist/utils/ast-path-operations.js.map +1 -0
- package/dist/utils/config.d.ts +3 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +49 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/github-setup.d.ts +74 -0
- package/dist/utils/github-setup.d.ts.map +1 -0
- package/dist/utils/github-setup.js +418 -0
- package/dist/utils/github-setup.js.map +1 -0
- package/dist/utils/idempotency.d.ts +47 -0
- package/dist/utils/idempotency.d.ts.map +1 -0
- package/dist/utils/idempotency.js +176 -0
- package/dist/utils/idempotency.js.map +1 -0
- package/dist/utils/preflight.d.ts +55 -0
- package/dist/utils/preflight.d.ts.map +1 -0
- package/dist/utils/preflight.js +261 -0
- package/dist/utils/preflight.js.map +1 -0
- package/dist/utils/versioning.d.ts +41 -0
- package/dist/utils/versioning.d.ts.map +1 -0
- package/dist/utils/versioning.js +219 -0
- package/dist/utils/versioning.js.map +1 -0
- package/docs/USER_JOURNEY_ERRORS.md +352 -0
- package/eslint.config.js +77 -0
- package/examples/basic-config.json +41 -0
- package/examples/monorepo-config.json +49 -0
- package/examples/usage.md +289 -0
- package/package.json +58 -0
- package/scripts/debug-workflows.sh +339 -0
- package/scripts/parse-pipeline.js +29 -0
- package/scripts/test-job-order.cjs +140 -0
- package/scripts/validate-pipeline.cjs +379 -0
- package/scripts/verify-job-order.sh +30 -0
- package/src/cli/index.ts +414 -0
- package/src/generators/init.tpl.ts +126 -0
- package/src/generators/workflows.tpl.ts +80 -0
- package/src/templates/actions/calculate-version.yml.tpl.ts +124 -0
- package/src/templates/actions/create-pr.yml.tpl.ts +147 -0
- package/src/templates/actions/create-tag.yml.tpl.ts +112 -0
- package/src/templates/actions/detect-changes.yml.tpl.ts +87 -0
- package/src/templates/actions/manage-branch.yml.tpl.ts +132 -0
- package/src/templates/actions/promote-branch.yml.tpl.ts +364 -0
- package/src/templates/workflows/pipeline-path-based.yml.tpl.ts +706 -0
- package/src/types/index.ts +64 -0
- package/src/utils/README-ast-path-operations.md +390 -0
- package/src/utils/ast-path-operations.ts +581 -0
- package/src/utils/config.ts +64 -0
- package/src/utils/github-setup.ts +558 -0
- package/src/utils/idempotency.ts +215 -0
- package/src/utils/preflight.ts +306 -0
- package/src/utils/versioning.ts +244 -0
- package/tests/README.md +229 -0
- package/tests/TEST_STRUCTURE.md +256 -0
- package/tests/act/run-act-tests.sh +345 -0
- package/tests/debugging/debug-utils.ts +538 -0
- package/tests/debugging/debug-workflow.test.ts +339 -0
- package/tests/debugging/debug-workflows.sh +339 -0
- package/tests/debugging/iterative-debug.ts +652 -0
- package/tests/debugging/run-debug-tests.sh +431 -0
- package/tests/fixtures/basic-config.json +51 -0
- package/tests/fixtures/invalid-config.json +9 -0
- package/tests/fixtures/pipeline-generated.yml +235 -0
- package/tests/fixtures/pipeline-preserve-comments.yml +245 -0
- package/tests/fixtures/pipeline-user-modified.yml +245 -0
- package/tests/fixtures/test-config.json +58 -0
- package/tests/github-live/README.md +250 -0
- package/tests/github-local/JOB_WORKFLOW_TESTS.md +296 -0
- package/tests/github-local/README.md +240 -0
- package/tests/github-local/run-all-tests.sh +422 -0
- package/tests/github-local/test-job-workflows.sh +631 -0
- package/tests/github-local/test-pipeline-workflow.sh +440 -0
- package/tests/integration/generators.test.ts +578 -0
- package/tests/integration/path-based-template.test.ts +510 -0
- package/tests/integration/simple-path-based.test.ts +415 -0
- package/tests/setup.ts +56 -0
- package/tests/unit/ast-path-operations-extended.test.ts +302 -0
- package/tests/unit/cli.test.ts +541 -0
- package/tests/unit/config-extended.test.ts +412 -0
- package/tests/unit/config.test.ts +152 -0
- package/tests/unit/github-setup.test.ts +189 -0
- package/tests/unit/idempotency-isolated.test.ts +297 -0
- package/tests/unit/job-order.test.ts +157 -0
- package/tests/unit/pipeline-path-based.test.ts +511 -0
- package/tests/unit/validate-pipeline.test.ts +384 -0
- package/tests/unit/versioning-extended.test.ts +279 -0
- package/tests/unit/versioning.test.ts +241 -0
- package/tsconfig.debug.json +17 -0
- package/tsconfig.json +28 -0
- package/vitest.config.ts +51 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
# Trunk-Based Flow Plan for PipeCraft
|
|
2
|
+
|
|
3
|
+
## Vision
|
|
4
|
+
PipeCraft generates GitHub Actions workflows that support **trunk-based delivery** with configurable promotion gates. Code flows automatically from an initial branch through intermediate branches to a final branch, with optional manual approval gates.
|
|
5
|
+
|
|
6
|
+
## Why Temporary Branches Are REQUIRED
|
|
7
|
+
|
|
8
|
+
### The GitHub Token Constraint
|
|
9
|
+
|
|
10
|
+
**Critical Limitation:** Pushes made with `GITHUB_TOKEN` do NOT trigger workflows.
|
|
11
|
+
|
|
12
|
+
This is by design to prevent infinite loops of workflows triggering workflows. This means:
|
|
13
|
+
|
|
14
|
+
❌ **What DOESN'T work:**
|
|
15
|
+
```
|
|
16
|
+
git push origin staging # Using GITHUB_TOKEN
|
|
17
|
+
# Result: staging is updated, but no workflow runs!
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
✅ **What DOES work:**
|
|
21
|
+
```
|
|
22
|
+
Create PR → Merge PR (even by bot)
|
|
23
|
+
# Result: workflow triggers naturally!
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Why PRs Are The Only Solution
|
|
27
|
+
|
|
28
|
+
**Key Insight:** PR merges (including auto-merges) DO trigger workflows, even with `GITHUB_TOKEN`.
|
|
29
|
+
|
|
30
|
+
Therefore:
|
|
31
|
+
- **All promotions must use PRs** (both auto and manual)
|
|
32
|
+
- **Fast-forward pushes are not reliable** with GITHUB_TOKEN
|
|
33
|
+
- **PAT tokens are not acceptable** (user-scoped, security risk)
|
|
34
|
+
|
|
35
|
+
### Why Direct Branch PRs Don't Work Well
|
|
36
|
+
|
|
37
|
+
**Without temp branches:**
|
|
38
|
+
```
|
|
39
|
+
develop (at commit C) → create PR from develop to staging (at commit A)
|
|
40
|
+
|
|
41
|
+
Problem: PR shows ALL commits B, C, D since branches diverged
|
|
42
|
+
- Can't have multiple releases "in flight"
|
|
43
|
+
- History becomes messy with merge commits
|
|
44
|
+
- Can't easily identify "what was promoted when"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**With temp branches:**
|
|
48
|
+
```
|
|
49
|
+
develop (at commit C) → create temp/release-v1.2.3 → PR from temp to staging
|
|
50
|
+
|
|
51
|
+
Benefits:
|
|
52
|
+
- PR represents single atomic promotion
|
|
53
|
+
- Multiple releases can be prepared simultaneously
|
|
54
|
+
- Clean rollback points (just delete temp branch)
|
|
55
|
+
- Clear audit trail (each PR = one release decision)
|
|
56
|
+
- History stays linear (squash merge = one commit per release)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Core Concept: Promotion Flow
|
|
60
|
+
|
|
61
|
+
### Universal Flow (Both Auto and Manual)
|
|
62
|
+
|
|
63
|
+
**All promotions use the same mechanism:**
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
Source Branch → [Create Temp Branch] → [Create PR] → [Merge Strategy] → Target Branch
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
1. **Create temp branch** from source (e.g., `release/develop-to-staging-v1.2.3`)
|
|
70
|
+
2. **Create PR** from temp branch to target
|
|
71
|
+
3. **Merge strategy** determines automation level:
|
|
72
|
+
- **Auto:** Enable GitHub's auto-merge feature
|
|
73
|
+
- **Manual:** Require human approval
|
|
74
|
+
|
|
75
|
+
### Flow Type 1: Auto-Promote
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
develop → [temp branch + PR + auto-merge] → staging
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
- Temp branch created automatically
|
|
82
|
+
- PR created with auto-merge enabled
|
|
83
|
+
- PR merges automatically when checks pass
|
|
84
|
+
- Staging workflow triggers from merge
|
|
85
|
+
- Temp branch cleaned up
|
|
86
|
+
|
|
87
|
+
### Flow Type 2: Manual-Promote
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
staging → [temp branch + PR + approval] → production
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- Temp branch created automatically
|
|
94
|
+
- PR created without auto-merge
|
|
95
|
+
- Human reviews and approves
|
|
96
|
+
- Human merges PR
|
|
97
|
+
- Production workflow triggers from merge
|
|
98
|
+
- Temp branch cleaned up
|
|
99
|
+
|
|
100
|
+
### Key Innovation
|
|
101
|
+
|
|
102
|
+
**Auto and manual use the SAME mechanism** - just different merge policies!
|
|
103
|
+
- Not two different systems
|
|
104
|
+
- Same code paths
|
|
105
|
+
- Same audit trail
|
|
106
|
+
- Same cleanup process
|
|
107
|
+
|
|
108
|
+
## Configuration Schema
|
|
109
|
+
|
|
110
|
+
### `.pipecraftrc.json`
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"branchFlow": ["develop", "staging", "main"],
|
|
115
|
+
|
|
116
|
+
"autoMerge": {
|
|
117
|
+
"staging": true, // Auto-merge to staging (temp branch + PR + auto-merge)
|
|
118
|
+
"main": false // Manual gate to main (temp branch + PR + approval)
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
// Optional: customize temp branch naming
|
|
122
|
+
"tempBranchPattern": "release/{source}-to-{target}-{version}"
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### How autoMerge Works
|
|
127
|
+
|
|
128
|
+
**Both `true` and `false` create temp branches + PRs:**
|
|
129
|
+
|
|
130
|
+
**When `true` (Auto-promote):**
|
|
131
|
+
1. Create temp branch: `release/develop-to-staging-v1.2.3`
|
|
132
|
+
2. Create PR from temp to target
|
|
133
|
+
3. **Enable GitHub auto-merge on PR**
|
|
134
|
+
4. PR merges automatically when checks pass
|
|
135
|
+
5. Target workflow triggers
|
|
136
|
+
6. Temp branch cleaned up
|
|
137
|
+
|
|
138
|
+
**When `false` (Manual-promote):**
|
|
139
|
+
1. Create temp branch: `release/staging-to-main-v1.2.3`
|
|
140
|
+
2. Create PR from temp to target
|
|
141
|
+
3. **Leave PR for human approval**
|
|
142
|
+
4. Human reviews and merges
|
|
143
|
+
5. Target workflow triggers
|
|
144
|
+
6. Temp branch cleaned up
|
|
145
|
+
|
|
146
|
+
### Common Patterns
|
|
147
|
+
|
|
148
|
+
**Pattern 1: Auto-all-but-final (RECOMMENDED)**
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"branchFlow": ["develop", "staging", "main"],
|
|
152
|
+
"autoMerge": {
|
|
153
|
+
"staging": true,
|
|
154
|
+
"main": false
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
Result: develop → auto → staging → manual → main
|
|
159
|
+
|
|
160
|
+
**Pattern 2: Auto-all**
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"branchFlow": ["develop", "staging", "main"],
|
|
164
|
+
"autoMerge": {
|
|
165
|
+
"staging": true,
|
|
166
|
+
"main": true
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
Result: develop → auto → staging → auto → main
|
|
171
|
+
|
|
172
|
+
**Pattern 3: Manual-all**
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"branchFlow": ["develop", "staging", "main"],
|
|
176
|
+
"autoMerge": {
|
|
177
|
+
"staging": false,
|
|
178
|
+
"main": false
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
Result: develop → manual → staging → manual → main
|
|
183
|
+
|
|
184
|
+
## Implementation Plan
|
|
185
|
+
|
|
186
|
+
### Phase 1: Core Flow Engine (Current Work)
|
|
187
|
+
|
|
188
|
+
**Goal:** Get basic auto-merge working for PipeCraft itself
|
|
189
|
+
|
|
190
|
+
- [x] Add `autoMerge` config support (per-branch boolean)
|
|
191
|
+
- [x] Generate conditional `branch` job based on config
|
|
192
|
+
- [x] Trigger workflow on target branch after fast-forward
|
|
193
|
+
- [ ] Fix PR creation for manual gates
|
|
194
|
+
- [ ] Test end-to-end flow
|
|
195
|
+
|
|
196
|
+
**PipeCraft Config (for itself):**
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"branchFlow": ["develop", "staging", "main"],
|
|
200
|
+
"autoMerge": {
|
|
201
|
+
"staging": true, // develop → auto → staging
|
|
202
|
+
"main": false // staging → PR → main
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Phase 2: Strategy Abstraction
|
|
208
|
+
|
|
209
|
+
**Goal:** Make promotion strategies configurable and reusable
|
|
210
|
+
|
|
211
|
+
#### 2.1 Add `promotionStrategy` to config
|
|
212
|
+
- Replace simple `autoMerge` boolean with strategy object
|
|
213
|
+
- Support preset strategies: `auto-all-but-final`, `auto-all`, `manual-all`
|
|
214
|
+
- Default to `auto-all-but-final`
|
|
215
|
+
|
|
216
|
+
#### 2.2 Strategy Resolution
|
|
217
|
+
- Convert strategy preset to per-branch settings
|
|
218
|
+
- Generate appropriate workflow jobs based on strategy
|
|
219
|
+
- Backward compatible with existing `autoMerge` config
|
|
220
|
+
|
|
221
|
+
#### 2.3 Template Updates
|
|
222
|
+
- Update `pipeline-path-based.yml.tpl.ts` to use strategy config
|
|
223
|
+
- Generate `branch` job for auto promotion
|
|
224
|
+
- Generate `createpr` job for manual gates
|
|
225
|
+
- Conditional job generation based on strategy
|
|
226
|
+
|
|
227
|
+
### Phase 3: Temporary Branch Support
|
|
228
|
+
|
|
229
|
+
**Goal:** Support clean branch history with approval gates
|
|
230
|
+
|
|
231
|
+
#### 3.1 Temp Branch Creation
|
|
232
|
+
- Add `useTempBranch` option per target branch
|
|
233
|
+
- Generate temp branch name from pattern
|
|
234
|
+
- Create temp branch from source
|
|
235
|
+
- Push temp branch to remote
|
|
236
|
+
|
|
237
|
+
#### 3.2 PR from Temp Branch
|
|
238
|
+
- Create PR from temp branch to target
|
|
239
|
+
- Include version info in PR body
|
|
240
|
+
- Tag temp branch for traceability
|
|
241
|
+
|
|
242
|
+
#### 3.3 Cleanup
|
|
243
|
+
- Delete temp branch after successful merge
|
|
244
|
+
- Optional: keep temp branches for audit trail
|
|
245
|
+
|
|
246
|
+
### Phase 4: Advanced Features
|
|
247
|
+
|
|
248
|
+
#### 4.1 Environment Gates
|
|
249
|
+
- Link branches to deployment environments
|
|
250
|
+
- Support GitHub environment protection rules
|
|
251
|
+
- Required reviewers per environment
|
|
252
|
+
|
|
253
|
+
#### 4.2 Promotion Triggers
|
|
254
|
+
- Manual workflow dispatch to promote
|
|
255
|
+
- Scheduled promotions (e.g., production deploys Friday 5pm)
|
|
256
|
+
- Event-driven promotions (e.g., after stakeholder approval)
|
|
257
|
+
|
|
258
|
+
#### 4.3 Rollback Support
|
|
259
|
+
- Fast-forward rollback to previous commit
|
|
260
|
+
- Create rollback PR with previous version
|
|
261
|
+
- Automated rollback on failure detection
|
|
262
|
+
|
|
263
|
+
## Workflow Job Structure
|
|
264
|
+
|
|
265
|
+
### Jobs Generated Based on Strategy
|
|
266
|
+
|
|
267
|
+
```yaml
|
|
268
|
+
jobs:
|
|
269
|
+
changes:
|
|
270
|
+
# Always runs - detects what changed
|
|
271
|
+
|
|
272
|
+
version:
|
|
273
|
+
# Always runs on initial branch - calculates next version
|
|
274
|
+
|
|
275
|
+
test-*:
|
|
276
|
+
# Conditional - runs if relevant changes detected
|
|
277
|
+
|
|
278
|
+
tag:
|
|
279
|
+
# Always runs on initial branch - creates git tag
|
|
280
|
+
|
|
281
|
+
# PROMOTION JOBS (generated based on strategy):
|
|
282
|
+
|
|
283
|
+
promote-to-staging:
|
|
284
|
+
# If auto: fast-forward staging, trigger workflow
|
|
285
|
+
# If manual + no temp: create PR to staging
|
|
286
|
+
# If manual + temp: create temp branch + PR to staging
|
|
287
|
+
if: github.ref_name == 'develop' # Source branch condition
|
|
288
|
+
needs: [test-*, tag]
|
|
289
|
+
runs-on: ubuntu-latest
|
|
290
|
+
steps:
|
|
291
|
+
- name: Auto Promote
|
|
292
|
+
if: strategy == 'auto'
|
|
293
|
+
# Fast-forward staging to develop
|
|
294
|
+
# Trigger workflow on staging
|
|
295
|
+
|
|
296
|
+
- name: Create Temp Branch
|
|
297
|
+
if: strategy == 'manual' && useTempBranch
|
|
298
|
+
# Create release/develop-to-staging-v1.2.3
|
|
299
|
+
|
|
300
|
+
- name: Create PR
|
|
301
|
+
if: strategy == 'manual'
|
|
302
|
+
# Create PR (from temp branch or source)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Success Criteria
|
|
306
|
+
|
|
307
|
+
### Phase 1 (Current)
|
|
308
|
+
- [ ] PipeCraft successfully auto-merges develop → staging
|
|
309
|
+
- [ ] Staging workflow triggers automatically after merge
|
|
310
|
+
- [ ] Manual PR created for staging → main
|
|
311
|
+
- [ ] PR merge triggers main workflow
|
|
312
|
+
|
|
313
|
+
### Phase 2
|
|
314
|
+
- [ ] Config supports `promotionStrategy` with presets
|
|
315
|
+
- [ ] `auto-all-but-final` works for 3+ branch flows
|
|
316
|
+
- [ ] Documentation for all strategy types
|
|
317
|
+
- [ ] Migration guide from `autoMerge` to `promotionStrategy`
|
|
318
|
+
|
|
319
|
+
### Phase 3
|
|
320
|
+
- [ ] Temp branches created for manual gates
|
|
321
|
+
- [ ] Clean branch history (no merge commits from temp branches)
|
|
322
|
+
- [ ] Temp branches properly cleaned up after merge
|
|
323
|
+
|
|
324
|
+
### Phase 4
|
|
325
|
+
- [ ] Environment protection integrated
|
|
326
|
+
- [ ] Manual promotion triggers work
|
|
327
|
+
- [ ] Rollback workflows generated and tested
|
|
328
|
+
|
|
329
|
+
## Migration Path
|
|
330
|
+
|
|
331
|
+
### Current Users (with `autoMerge`)
|
|
332
|
+
```json
|
|
333
|
+
// OLD
|
|
334
|
+
{
|
|
335
|
+
"autoMerge": {
|
|
336
|
+
"staging": true,
|
|
337
|
+
"main": false
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// NEW (automatically converted)
|
|
342
|
+
{
|
|
343
|
+
"promotionStrategy": {
|
|
344
|
+
"type": "custom",
|
|
345
|
+
"branches": {
|
|
346
|
+
"staging": { "strategy": "auto" },
|
|
347
|
+
"main": { "strategy": "manual" }
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### PipeCraft Itself
|
|
354
|
+
```json
|
|
355
|
+
{
|
|
356
|
+
"branchFlow": ["develop", "staging", "main"],
|
|
357
|
+
"promotionStrategy": {
|
|
358
|
+
"type": "auto-all-but-final" // Simple!
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
This expands to:
|
|
364
|
+
- develop → auto → staging
|
|
365
|
+
- staging → auto → (no more branches, so this is skipped)
|
|
366
|
+
- staging → manual → main (final branch gets manual gate)
|
|
367
|
+
|
|
368
|
+
## Questions to Resolve
|
|
369
|
+
|
|
370
|
+
1. **Temp branch naming:** Pattern should be configurable or fixed?
|
|
371
|
+
- Proposal: `release/{source}-to-{target}-{version}`
|
|
372
|
+
|
|
373
|
+
2. **PR body format:** What info to include?
|
|
374
|
+
- Version
|
|
375
|
+
- Changelog since last promotion
|
|
376
|
+
- Test results summary
|
|
377
|
+
|
|
378
|
+
3. **Cleanup timing:** When to delete temp branches?
|
|
379
|
+
- Immediately after merge
|
|
380
|
+
- After next successful promotion
|
|
381
|
+
- Manual cleanup only
|
|
382
|
+
|
|
383
|
+
4. **Failed promotions:** What happens?
|
|
384
|
+
- Leave temp branch and PR open
|
|
385
|
+
- Auto-close and create new temp branch on retry
|
|
386
|
+
|
|
387
|
+
5. **Multiple pending promotions:** Allow or block?
|
|
388
|
+
- One temp branch per target at a time
|
|
389
|
+
- Multiple temp branches allowed (might be confusing)
|
|
390
|
+
|
|
391
|
+
## Next Steps
|
|
392
|
+
|
|
393
|
+
1. **Finish Phase 1** - Get current implementation working for PipeCraft
|
|
394
|
+
2. **Document current behavior** - Write user guide for `autoMerge` config
|
|
395
|
+
3. **Design Phase 2 config** - Get feedback on `promotionStrategy` schema
|
|
396
|
+
4. **Prototype temp branches** - Test the concept with manual workflow
|
|
397
|
+
5. **Implement Phase 2** - Add strategy abstraction layer
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
**Key Insight:** The "temp branch flow" is actually the **best default for manual gates** because it keeps the branch history clean and makes the approval action explicit and traceable. The PR represents "the decision to promote" rather than "these commits".
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|