pipecraft 0.29.3 → 0.36.14
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 +128 -54
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +68 -25
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/init.tpl.d.ts +4 -4
- package/dist/generators/init.tpl.d.ts.map +1 -1
- package/dist/generators/init.tpl.js +214 -108
- package/dist/generators/init.tpl.js.map +1 -1
- package/dist/generators/workflows.tpl.d.ts +9 -9
- package/dist/generators/workflows.tpl.d.ts.map +1 -1
- package/dist/generators/workflows.tpl.js +33 -36
- package/dist/generators/workflows.tpl.js.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts +7 -4
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.js +49 -23
- package/dist/templates/actions/calculate-version.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-pr.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/create-pr.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-pr.yml.tpl.js +14 -8
- package/dist/templates/actions/create-pr.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-release.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/create-release.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-release.yml.tpl.js +16 -11
- package/dist/templates/actions/create-release.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-tag.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/create-tag.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-tag.yml.tpl.js +13 -9
- package/dist/templates/actions/create-tag.yml.tpl.js.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts +17 -51
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.js +130 -110
- package/dist/templates/actions/detect-changes.yml.tpl.js.map +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.js +13 -9
- package/dist/templates/actions/manage-branch.yml.tpl.js.map +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.js +39 -92
- package/dist/templates/actions/promote-branch.yml.tpl.js.map +1 -1
- package/dist/templates/release-it.cjs.tpl.d.ts +1 -1
- package/dist/templates/release-it.cjs.tpl.d.ts.map +1 -1
- package/dist/templates/release-it.cjs.tpl.js +38 -29
- package/dist/templates/release-it.cjs.tpl.js.map +1 -1
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.d.ts +1 -1
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.js +2 -3
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts +2 -2
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pipeline.yml.tpl.js +337 -84
- package/dist/templates/workflows/pipeline.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/pr-title-check.yml.tpl.d.ts +1 -1
- package/dist/templates/workflows/pr-title-check.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pr-title-check.yml.tpl.js +101 -22
- package/dist/templates/workflows/pr-title-check.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/shared/index.d.ts +4 -2
- package/dist/templates/workflows/shared/index.d.ts.map +1 -1
- package/dist/templates/workflows/shared/index.js +4 -2
- package/dist/templates/workflows/shared/index.js.map +1 -1
- package/dist/templates/workflows/shared/managed-workflow.d.ts +32 -0
- package/dist/templates/workflows/shared/managed-workflow.d.ts.map +1 -0
- package/dist/templates/workflows/shared/managed-workflow.js +51 -0
- package/dist/templates/workflows/shared/managed-workflow.js.map +1 -0
- package/dist/templates/workflows/shared/operations-changes.d.ts +13 -3
- package/dist/templates/workflows/shared/operations-changes.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-changes.js +42 -16
- package/dist/templates/workflows/shared/operations-changes.js.map +1 -1
- package/dist/templates/workflows/shared/operations-domain-jobs.d.ts +18 -1
- package/dist/templates/workflows/shared/operations-domain-jobs.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-domain-jobs.js +142 -17
- package/dist/templates/workflows/shared/operations-domain-jobs.js.map +1 -1
- package/dist/templates/workflows/shared/operations-gate.d.ts +6 -0
- package/dist/templates/workflows/shared/operations-gate.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-gate.js +116 -0
- package/dist/templates/workflows/shared/operations-gate.js.map +1 -0
- package/dist/templates/workflows/shared/operations-header.d.ts +11 -1
- package/dist/templates/workflows/shared/operations-header.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-header.js +66 -7
- package/dist/templates/workflows/shared/operations-header.js.map +1 -1
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts +4 -3
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-tag-promote.js +144 -33
- package/dist/templates/workflows/shared/operations-tag-promote.js.map +1 -1
- package/dist/templates/workflows/shared/operations-version.d.ts +3 -2
- package/dist/templates/workflows/shared/operations-version.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-version.js +17 -16
- package/dist/templates/workflows/shared/operations-version.js.map +1 -1
- package/dist/templates/yaml-format-utils.d.ts.map +1 -1
- package/dist/templates/yaml-format-utils.js +1 -5
- package/dist/templates/yaml-format-utils.js.map +1 -1
- package/dist/types/index.d.ts +65 -53
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/action-reference.d.ts +73 -0
- package/dist/utils/action-reference.d.ts.map +1 -0
- package/dist/utils/action-reference.js +120 -0
- package/dist/utils/action-reference.js.map +1 -0
- package/dist/utils/ast-path-operations.d.ts +3 -3
- package/dist/utils/ast-path-operations.d.ts.map +1 -1
- package/dist/utils/ast-path-operations.js +58 -17
- package/dist/utils/ast-path-operations.js.map +1 -1
- package/dist/utils/config.d.ts +16 -5
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +69 -12
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/github-setup.d.ts +7 -7
- package/dist/utils/github-setup.d.ts.map +1 -1
- package/dist/utils/github-setup.js +84 -63
- package/dist/utils/github-setup.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/messaging.d.ts +2 -2
- package/dist/utils/messaging.d.ts.map +1 -1
- package/dist/utils/messaging.js +12 -8
- package/dist/utils/messaging.js.map +1 -1
- package/dist/utils/preflight.d.ts +2 -2
- package/dist/utils/preflight.d.ts.map +1 -1
- package/dist/utils/preflight.js +43 -41
- package/dist/utils/preflight.js.map +1 -1
- package/dist/utils/versioning.d.ts +1 -1
- package/dist/utils/versioning.d.ts.map +1 -1
- package/dist/utils/versioning.js +10 -10
- package/dist/utils/versioning.js.map +1 -1
- package/dist/utils/workflow-semantics.d.ts +61 -0
- package/dist/utils/workflow-semantics.d.ts.map +1 -0
- package/dist/utils/workflow-semantics.js +230 -0
- package/dist/utils/workflow-semantics.js.map +1 -0
- package/package.json +12 -4
- package/src/generators/init.tpl.ts +275 -128
- package/src/generators/workflows.tpl.ts +54 -57
- package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts +0 -32
- package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts.map +0 -1
- package/dist/templates/actions/detect-changes-nx.yml.tpl.js +0 -227
- package/dist/templates/actions/detect-changes-nx.yml.tpl.js.map +0 -1
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts +0 -22
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts.map +0 -1
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js +0 -196
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js.map +0 -1
- package/dist/utils/idempotency.d.ts +0 -187
- package/dist/utils/idempotency.d.ts.map +0 -1
- package/dist/utils/idempotency.js +0 -304
- package/dist/utils/idempotency.js.map +0 -1
|
@@ -4,112 +4,223 @@
|
|
|
4
4
|
* Generates the tag creation, branch promotion, and GitHub release jobs.
|
|
5
5
|
*/
|
|
6
6
|
import { createValueFromString } from '../../../utils/ast-path-operations.js';
|
|
7
|
+
import { getActionReference } from '../../../utils/action-reference.js';
|
|
7
8
|
/**
|
|
8
9
|
* Create tag, promote, and release job operations
|
|
9
10
|
*/
|
|
10
11
|
export function createTagPromoteReleaseOperations(ctx) {
|
|
11
|
-
const { branchFlow,
|
|
12
|
+
const { branchFlow, config = {} } = ctx;
|
|
12
13
|
// Provide sensible defaults if branchFlow is invalid
|
|
13
|
-
const validBranchFlow =
|
|
14
|
-
const allDeploymentJobs = [...deployJobNames, ...remoteTestJobNames];
|
|
14
|
+
const validBranchFlow = branchFlow && Array.isArray(branchFlow) && branchFlow.length > 0 ? branchFlow : ['main'];
|
|
15
15
|
const initialBranch = validBranchFlow[0];
|
|
16
|
+
// Get action references based on configuration
|
|
17
|
+
const tagActionRef = getActionReference('create-tag', config);
|
|
18
|
+
const promoteActionRef = getActionReference('promote-branch', config);
|
|
19
|
+
const releaseActionRef = getActionReference('create-release', config);
|
|
16
20
|
// Build tag job conditional (should only run on initial branch, not on PRs)
|
|
21
|
+
// Now depends on the gate job instead of individual test jobs
|
|
17
22
|
const tagConditions = [
|
|
18
23
|
'always()',
|
|
19
|
-
|
|
24
|
+
"github.event_name != 'pull_request'",
|
|
20
25
|
`github.ref_name == '${initialBranch}'`,
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
"needs.version.result == 'success'",
|
|
27
|
+
"needs.version.outputs.version != ''",
|
|
28
|
+
"needs.gate.result == 'success'" // Gate job must succeed
|
|
23
29
|
];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
tagConditions.push(`(${noFailures})`);
|
|
28
|
-
tagConditions.push(`(${atLeastOneSuccess})`);
|
|
29
|
-
}
|
|
30
|
-
const tagNeedsArray = ['version', ...allDeploymentJobs];
|
|
30
|
+
// Default needs: version + gate (gate already checks all test jobs)
|
|
31
|
+
const tagNeedsArray = ['version', 'gate'];
|
|
32
|
+
const defaultTagIfCondition = tagConditions.join(' && ');
|
|
31
33
|
return [
|
|
32
|
-
// TAG JOB
|
|
34
|
+
// TAG JOB - Ensure the job key exists with comment (but don't overwrite existing job)
|
|
33
35
|
{
|
|
34
36
|
path: 'jobs.tag',
|
|
35
|
-
operation: '
|
|
37
|
+
operation: 'preserve',
|
|
38
|
+
spaceBefore: true,
|
|
36
39
|
commentBefore: `
|
|
37
40
|
=============================================================================
|
|
38
|
-
TAG
|
|
41
|
+
TAG (⚠️ Managed by Pipecraft - customizable needs and if)
|
|
39
42
|
=============================================================================
|
|
40
|
-
Creates git tags and promotes code through branch flow.
|
|
43
|
+
Creates git tags and promotes code through branch flow.
|
|
44
|
+
The 'needs' and 'if' fields are customizable and will be preserved.
|
|
45
|
+
All other fields (runs-on, steps) are managed by Pipecraft.
|
|
41
46
|
`,
|
|
47
|
+
value: {} // Empty object - just ensures the job exists with the comment
|
|
48
|
+
},
|
|
49
|
+
// TAG JOB NEEDS - Preserve user customizations, default to version + gate
|
|
50
|
+
{
|
|
51
|
+
path: 'jobs.tag.needs',
|
|
52
|
+
operation: 'preserve',
|
|
53
|
+
value: tagNeedsArray
|
|
54
|
+
},
|
|
55
|
+
// TAG JOB IF - Preserve user customizations, default to standard conditions
|
|
56
|
+
//
|
|
57
|
+
// Now simplified: just check that gate job succeeded (gate already validates all tests)
|
|
58
|
+
//
|
|
59
|
+
// Pattern:
|
|
60
|
+
// if: ${{
|
|
61
|
+
// always() &&
|
|
62
|
+
// github.event_name != 'pull_request' &&
|
|
63
|
+
// github.ref_name == 'develop' &&
|
|
64
|
+
// needs.version.result == 'success' &&
|
|
65
|
+
// needs.version.outputs.version != '' &&
|
|
66
|
+
// needs.gate.result == 'success'
|
|
67
|
+
// }}
|
|
68
|
+
{
|
|
69
|
+
path: 'jobs.tag.if',
|
|
70
|
+
operation: 'preserve',
|
|
71
|
+
value: createValueFromString(`\${{ ${defaultTagIfCondition} }}`)
|
|
72
|
+
},
|
|
73
|
+
// TAG JOB RUNS-ON - Always managed
|
|
74
|
+
{
|
|
75
|
+
path: 'jobs.tag.runs-on',
|
|
76
|
+
operation: 'overwrite',
|
|
77
|
+
value: 'ubuntu-latest'
|
|
78
|
+
},
|
|
79
|
+
// TAG JOB STEPS - Always managed
|
|
80
|
+
{
|
|
81
|
+
path: 'jobs.tag.steps',
|
|
82
|
+
operation: 'overwrite',
|
|
42
83
|
value: createValueFromString(`
|
|
43
|
-
if: \${{ ${tagConditions.join(' && ')} }}
|
|
44
|
-
needs: [ ${tagNeedsArray.join(', ')} ]
|
|
45
|
-
runs-on: ubuntu-latest
|
|
46
|
-
steps:
|
|
47
84
|
- uses: actions/checkout@v4
|
|
48
85
|
with:
|
|
49
86
|
ref: \${{ inputs.commitSha || github.sha }}
|
|
50
|
-
|
|
87
|
+
fetch-depth: \${{ env.FETCH_DEPTH_VERSIONING }}
|
|
88
|
+
- uses: ${tagActionRef}
|
|
51
89
|
with:
|
|
52
90
|
version: \${{ needs.version.outputs.version }}
|
|
53
|
-
commitSha: \${{ inputs.commitSha || github.sha }}
|
|
54
91
|
`)
|
|
55
92
|
},
|
|
56
93
|
// PROMOTE JOB
|
|
57
94
|
{
|
|
58
95
|
path: 'jobs.promote',
|
|
59
96
|
operation: 'overwrite',
|
|
97
|
+
spaceBefore: true,
|
|
98
|
+
commentBefore: `
|
|
99
|
+
=============================================================================
|
|
100
|
+
PROMOTE (⚠️ Managed by Pipecraft - do not modify)
|
|
101
|
+
=============================================================================
|
|
102
|
+
Promotes code from develop to staging or main via PR.
|
|
103
|
+
`,
|
|
60
104
|
value: createValueFromString(`
|
|
61
|
-
if: \${{ always() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && needs.version.result == 'success' && needs.version.outputs.version != '' && (needs.tag.result == 'success' || needs.tag.result == 'skipped') && (${buildPromotableBranchesCondition(validBranchFlow)}) }}
|
|
62
105
|
needs: [ version, tag ]
|
|
106
|
+
if: \${{ always() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && needs.version.result == 'success' && needs.version.outputs.version != '' && (needs.tag.result == 'success' || needs.tag.result == 'skipped') && (${buildPromotableBranchesCondition(validBranchFlow)}) }}
|
|
63
107
|
runs-on: ubuntu-latest
|
|
64
108
|
steps:
|
|
65
109
|
- uses: actions/checkout@v4
|
|
66
110
|
with:
|
|
67
111
|
ref: \${{ inputs.commitSha || github.sha }}
|
|
68
|
-
|
|
112
|
+
fetch-depth: \${{ env.FETCH_DEPTH_VERSIONING }}
|
|
113
|
+
- uses: ${promoteActionRef}
|
|
69
114
|
with:
|
|
70
115
|
version: \${{ needs.version.outputs.version }}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
116
|
+
sourceBranch: \${{ github.ref_name }}
|
|
117
|
+
targetBranch: \${{ ${buildTargetBranchExpression(validBranchFlow)} }}
|
|
118
|
+
autoPromote: \${{ ${buildAutoPromoteExpression(validBranchFlow, ctx.autoPromote)} }}
|
|
119
|
+
run_number: \${{ inputs.run_number || github.run_number }}
|
|
74
120
|
`)
|
|
75
121
|
},
|
|
76
122
|
// RELEASE JOB
|
|
77
123
|
{
|
|
78
124
|
path: 'jobs.release',
|
|
79
125
|
operation: 'overwrite',
|
|
126
|
+
spaceBefore: true,
|
|
127
|
+
commentBefore: `
|
|
128
|
+
=============================================================================
|
|
129
|
+
RELEASE (⚠️ Managed by Pipecraft - do not modify)
|
|
130
|
+
=============================================================================
|
|
131
|
+
Creates a release for the version.
|
|
132
|
+
`,
|
|
80
133
|
value: createValueFromString(`
|
|
81
|
-
if: \${{ always() && github.ref_name == '${validBranchFlow[validBranchFlow.length - 1]}' && needs.version.result == 'success' && needs.version.outputs.version != '' && needs.tag.result == 'success' }}
|
|
82
134
|
needs: [ tag, version ]
|
|
135
|
+
if: \${{ always() && github.ref_name == '${validBranchFlow[validBranchFlow.length - 1]}' && needs.version.result == 'success' && needs.version.outputs.version != '' && (needs.tag.result == 'success' || needs.tag.result == 'skipped') }}
|
|
83
136
|
runs-on: ubuntu-latest
|
|
84
137
|
steps:
|
|
85
138
|
- uses: actions/checkout@v4
|
|
86
139
|
with:
|
|
87
140
|
ref: \${{ inputs.commitSha || github.sha }}
|
|
88
|
-
|
|
141
|
+
fetch-depth: \${{ env.FETCH_DEPTH_VERSIONING }}
|
|
142
|
+
- uses: ${releaseActionRef}
|
|
89
143
|
with:
|
|
90
144
|
version: \${{ needs.version.outputs.version }}
|
|
91
|
-
commitSha: \${{ inputs.commitSha || github.sha }}
|
|
92
145
|
`)
|
|
93
146
|
}
|
|
94
147
|
];
|
|
95
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Builds a condition that ensures at least ONE success AND NO failures for a set of jobs.
|
|
151
|
+
*
|
|
152
|
+
* This is the standard pattern for gating jobs (like tag) that depend on multiple test/deploy jobs.
|
|
153
|
+
*
|
|
154
|
+
* Pattern:
|
|
155
|
+
* - NO failures: All jobs must not be 'failure' (skipped is OK, failure is not)
|
|
156
|
+
* - AT LEAST ONE success: At least one job must be 'success' (skipped doesn't count as success)
|
|
157
|
+
*
|
|
158
|
+
* @param jobNames - Array of job names to check (e.g., ['test-cicd', 'test-core', 'deploy-docs'])
|
|
159
|
+
* @returns Condition string like: "(needs.job1.result != 'failure' && needs.job2.result != 'failure') && (needs.job1.result == 'success' || needs.job2.result == 'success')"
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* // For test jobs
|
|
164
|
+
* buildAtLeastOneSuccessNoFailuresCondition(['test-cicd', 'test-core', 'test-docs'])
|
|
165
|
+
* // Returns: "(needs.test-cicd.result != 'failure' && needs.test-core.result != 'failure' && needs.test-docs.result != 'failure') && (needs.test-cicd.result == 'success' || needs.test-core.result == 'success' || needs.test-docs.result == 'success')"
|
|
166
|
+
*
|
|
167
|
+
* // For deployment jobs
|
|
168
|
+
* buildAtLeastOneSuccessNoFailuresCondition(['deploy-staging', 'deploy-prod'])
|
|
169
|
+
* // Returns: "(needs.deploy-staging.result != 'failure' && needs.deploy-prod.result != 'failure') && (needs.deploy-staging.result == 'success' || needs.deploy-prod.result == 'success')"
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
function buildAtLeastOneSuccessNoFailuresCondition(jobNames) {
|
|
173
|
+
if (jobNames.length === 0) {
|
|
174
|
+
return '';
|
|
175
|
+
}
|
|
176
|
+
// Ensure NO failures (skipped is OK, but failure is not)
|
|
177
|
+
const noFailures = jobNames.map(job => `needs.${job}.result != 'failure'`).join(' && ');
|
|
178
|
+
// Ensure AT LEAST ONE success (skipped jobs don't count as success)
|
|
179
|
+
const atLeastOneSuccess = jobNames.map(job => `needs.${job}.result == 'success'`).join(' || ');
|
|
180
|
+
return `(${noFailures}) && (${atLeastOneSuccess})`;
|
|
181
|
+
}
|
|
96
182
|
/**
|
|
97
183
|
* Helper to build promotable branches condition
|
|
98
184
|
* Returns a condition that checks if current branch is promotable (all except final branch)
|
|
185
|
+
* For single-branch workflows, returns 'false' to skip the promote job
|
|
99
186
|
*/
|
|
100
187
|
function buildPromotableBranchesCondition(branchFlow) {
|
|
101
188
|
const promotableBranches = branchFlow.slice(0, -1); // All branches except the last one
|
|
189
|
+
if (promotableBranches.length === 0) {
|
|
190
|
+
return 'false'; // Single-branch workflow - no promotion needed
|
|
191
|
+
}
|
|
102
192
|
return promotableBranches.map(branch => `github.ref_name == '${branch}'`).join(' || ');
|
|
103
193
|
}
|
|
104
194
|
/**
|
|
105
|
-
* Helper to build the
|
|
195
|
+
* Helper to build the targetBranch expression
|
|
196
|
+
* Maps each source branch to its target branch
|
|
106
197
|
*/
|
|
107
|
-
function
|
|
198
|
+
function buildTargetBranchExpression(branchFlow) {
|
|
108
199
|
if (branchFlow.length === 1)
|
|
109
200
|
return `''`;
|
|
110
201
|
if (branchFlow.length === 2)
|
|
111
202
|
return `'${branchFlow[1]}'`;
|
|
112
203
|
// For 3+ branches: develop → staging, staging → main
|
|
204
|
+
// github.ref_name == 'develop' && 'staging' || 'main'
|
|
113
205
|
return `github.ref_name == '${branchFlow[0]}' && '${branchFlow[1]}' || '${branchFlow[branchFlow.length - 1]}'`;
|
|
114
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Helper to build the autoPromote expression
|
|
209
|
+
* Maps each target branch to its autoPromote setting
|
|
210
|
+
*/
|
|
211
|
+
function buildAutoPromoteExpression(branchFlow, autoPromote) {
|
|
212
|
+
if (!autoPromote || branchFlow.length === 1)
|
|
213
|
+
return `'false'`;
|
|
214
|
+
const clauses = [];
|
|
215
|
+
for (let i = 0; i < branchFlow.length - 1; i += 1) {
|
|
216
|
+
const sourceBranch = branchFlow[i];
|
|
217
|
+
const targetBranch = branchFlow[i + 1];
|
|
218
|
+
const isEnabled = autoPromote[targetBranch] ? 'true' : 'false';
|
|
219
|
+
clauses.push(`(github.ref_name == '${sourceBranch}' && '${isEnabled}')`);
|
|
220
|
+
}
|
|
221
|
+
if (clauses.length === 0) {
|
|
222
|
+
return `'false'`;
|
|
223
|
+
}
|
|
224
|
+
return `${clauses.join(' || ')} || 'false'`;
|
|
225
|
+
}
|
|
115
226
|
//# sourceMappingURL=operations-tag-promote.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations-tag-promote.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-tag-promote.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"operations-tag-promote.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-tag-promote.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAC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C,CAClC,GAAG,CAAA;AACL,CAAC;AAED;;;GAGG;AACH,SAAS,0BAA0B,CACjC,UAAoB,EACpB,WAAqC;IAErC,IAAI,CAAC,WAAW,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IAE7D,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;QAClC,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QACtC,MAAM,SAAS,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QAC9D,OAAO,CAAC,IAAI,CAAC,wBAAwB,YAAY,SAAS,SAAS,IAAI,CAAC,CAAA;IAC1E,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAA;AAC7C,CAAC"}
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates the version calculation job that determines the next semantic version.
|
|
5
5
|
*/
|
|
6
|
-
import { PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
6
|
+
import { type PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
7
|
+
import type { PipecraftConfig } from '../../../types/index.js';
|
|
7
8
|
export interface VersionContext {
|
|
8
9
|
testJobNames: string[];
|
|
9
|
-
nxEnabled?: boolean;
|
|
10
10
|
baseRef?: string;
|
|
11
|
+
config?: Partial<PipecraftConfig>;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Create the version calculation job operation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations-version.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"operations-version.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAE9D,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAClC;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,cAAc,GAAG,mBAAmB,CAoDlF"}
|
|
@@ -4,51 +4,52 @@
|
|
|
4
4
|
* Generates the version calculation job that determines the next semantic version.
|
|
5
5
|
*/
|
|
6
6
|
import { createValueFromString } from '../../../utils/ast-path-operations.js';
|
|
7
|
+
import { getActionReference } from '../../../utils/action-reference.js';
|
|
7
8
|
/**
|
|
8
9
|
* Create the version calculation job operation
|
|
9
10
|
*/
|
|
10
11
|
export function createVersionJobOperation(ctx) {
|
|
11
|
-
const { testJobNames,
|
|
12
|
+
const { testJobNames, baseRef = 'main', config = {} } = ctx;
|
|
13
|
+
// Get the action reference based on configuration
|
|
14
|
+
const actionRef = getActionReference('calculate-version', config);
|
|
12
15
|
// Build the needs array
|
|
13
|
-
const
|
|
14
|
-
const needsArray = ['changes', nxJobName, ...testJobNames].filter(Boolean);
|
|
16
|
+
const needsArray = ['changes', ...testJobNames].filter(Boolean);
|
|
15
17
|
// Build the conditional logic
|
|
16
|
-
const nxCondition = nxEnabled ? 'needs.nx-ci.result == \'success\'' : '';
|
|
17
18
|
const testConditions = testJobNames.length > 0
|
|
18
19
|
? [
|
|
19
20
|
`(${testJobNames.map(job => `needs.${job}.result == 'success'`).join(' || ')})`,
|
|
20
21
|
testJobNames.map(job => `needs.${job}.result != 'failure'`).join(' && ')
|
|
21
22
|
]
|
|
22
23
|
: [];
|
|
23
|
-
const allConditions = [
|
|
24
|
-
|
|
25
|
-
'
|
|
26
|
-
nxCondition,
|
|
27
|
-
...testConditions
|
|
28
|
-
].filter(Boolean).join(' && ');
|
|
24
|
+
const allConditions = ['always()', "github.event_name != 'pull_request'", ...testConditions]
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.join(' && ');
|
|
29
27
|
return {
|
|
30
28
|
path: 'jobs.version',
|
|
31
29
|
operation: 'overwrite',
|
|
30
|
+
spaceBefore: true,
|
|
32
31
|
commentBefore: `
|
|
33
32
|
=============================================================================
|
|
34
|
-
VERSIONING (⚠️ Managed by Pipecraft - do not modify)
|
|
33
|
+
VERSIONING (⚠️ Managed by Pipecraft - do not modify)
|
|
35
34
|
=============================================================================
|
|
36
|
-
Calculates the next semantic version based on conventional commits.
|
|
37
|
-
Only runs on push events (skipped on pull requests).
|
|
35
|
+
Calculates the next semantic version based on conventional commits.
|
|
36
|
+
Only runs on push events (skipped on pull requests).
|
|
38
37
|
`,
|
|
39
38
|
value: createValueFromString(`
|
|
40
|
-
if: \${{ ${allConditions} }}
|
|
41
39
|
needs: [ ${needsArray.join(', ')} ]
|
|
40
|
+
if: \${{ ${allConditions} }}
|
|
42
41
|
runs-on: ubuntu-latest
|
|
43
42
|
steps:
|
|
44
43
|
- uses: actions/checkout@v4
|
|
45
44
|
with:
|
|
46
45
|
ref: \${{ inputs.commitSha || github.sha }}
|
|
47
|
-
|
|
46
|
+
fetch-depth: \${{ env.FETCH_DEPTH_VERSIONING }}
|
|
47
|
+
- uses: ${actionRef}
|
|
48
48
|
id: version
|
|
49
49
|
with:
|
|
50
50
|
baseRef: \${{ inputs.baseRef || '${baseRef}' }}
|
|
51
|
-
|
|
51
|
+
version: \${{ inputs.version }}
|
|
52
|
+
node-version: \${{ env.NODE_VERSION }}
|
|
52
53
|
outputs:
|
|
53
54
|
version: \${{ steps.version.outputs.version }}
|
|
54
55
|
`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations-version.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"operations-version.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,qBAAqB,EAEtB,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AASvE;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAmB;IAC3D,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,GAAG,CAAA;IAE3D,kDAAkD;IAClD,MAAM,SAAS,GAAG,kBAAkB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAA;IAEjE,wBAAwB;IACxB,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,GAAG,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAE/D,8BAA8B;IAC9B,MAAM,cAAc,GAClB,YAAY,CAAC,MAAM,GAAG,CAAC;QACrB,CAAC,CAAC;YACE,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,GAAG,sBAAsB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG;YAC/E,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,GAAG,sBAAsB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;SACzE;QACH,CAAC,CAAC,EAAE,CAAA;IAER,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,qCAAqC,EAAE,GAAG,cAAc,CAAC;SACzF,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,MAAM,CAAC,CAAA;IAEf,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,WAAW;QACtB,WAAW,EAAE,IAAI;QACjB,aAAa,EAAE;;;;;;CAMlB;QACG,KAAK,EAAE,qBAAqB,CAAC;eAClB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;eACrB,aAAa;;;;;;;gBAOZ,SAAS;;;6CAGoB,OAAO;;;;;GAKjD,CAAC;KACD,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml-format-utils.d.ts","sourceRoot":"","sources":["../../src/templates/yaml-format-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAW,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"yaml-format-utils.d.ts","sourceRoot":"","sources":["../../src/templates/yaml-format-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAW,GAAG,MAAM,CA0BtF"}
|
|
@@ -36,11 +36,7 @@ export function formatIfConditions(yamlContent, minLength = 80) {
|
|
|
36
36
|
// Step 2: Add line breaks for logical operators
|
|
37
37
|
formatted = formatted.replace(/\s+&&\s+/g, ' &&\n ');
|
|
38
38
|
formatted = formatted.replace(/\s+\|\|\s+/g, ' ||\n ');
|
|
39
|
-
// Step 3:
|
|
40
|
-
formatted = formatted.replace(/\(\s*/g, '(\n ');
|
|
41
|
-
formatted = formatted.replace(/\s*\)\s*(&&|\|\|)/g, '\n ) $1');
|
|
42
|
-
formatted = formatted.replace(/\s*\)(\s*)$/g, '\n )');
|
|
43
|
-
// Step 4: Restore function calls
|
|
39
|
+
// Step 3: Restore function calls
|
|
44
40
|
functionCalls.forEach((funcCall, index) => {
|
|
45
41
|
formatted = formatted.replace(`__FUNC_${index}__`, funcCall);
|
|
46
42
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml-format-utils.js","sourceRoot":"","sources":["../../src/templates/yaml-format-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB,EAAE,YAAoB,EAAE;IAC5E,OAAO,WAAW,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"yaml-format-utils.js","sourceRoot":"","sources":["../../src/templates/yaml-format-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB,EAAE,YAAoB,EAAE;IAC5E,OAAO,WAAW,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QACxE,yEAAyE;QACzE,IAAI,SAAS,CAAC,MAAM,GAAG,SAAS;YAAE,OAAO,KAAK,CAAA;QAE9C,IAAI,SAAS,GAAG,SAAS,CAAC,IAAI,EAAE,CAAA;QAEhC,8EAA8E;QAC9E,MAAM,aAAa,GAAa,EAAE,CAAA;QAClC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAa,EAAE,EAAE;YAC5D,MAAM,WAAW,GAAG,UAAU,aAAa,CAAC,MAAM,IAAI,CAAA;YACtD,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACzB,OAAO,WAAW,CAAA;QACpB,CAAC,CAAC,CAAA;QAEF,gDAAgD;QAChD,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,eAAe,CAAC,CAAA;QAC3D,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC,CAAA;QAE7D,iCAAiC;QACjC,aAAa,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;YACxC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,UAAU,KAAK,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC9D,CAAC,CAAC,CAAA;QAEF,OAAO,qBAAqB,SAAS,YAAY,CAAA;IACnD,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -34,32 +34,51 @@ export interface DomainConfig {
|
|
|
34
34
|
* Used in workflow comments and documentation.
|
|
35
35
|
*/
|
|
36
36
|
description: string;
|
|
37
|
+
/**
|
|
38
|
+
* Job prefixes to generate for this domain.
|
|
39
|
+
* Each prefix generates a customizable placeholder job named `{prefix}-{domain}`.
|
|
40
|
+
*
|
|
41
|
+
* For example, with domain 'core' and prefixes: ['test', 'deploy', 'lint']:
|
|
42
|
+
* - test-core (runs when core/ changes)
|
|
43
|
+
* - deploy-core (runs when core/ changes)
|
|
44
|
+
* - lint-core (runs when core/ changes)
|
|
45
|
+
*
|
|
46
|
+
* These are placeholder jobs where you add your own logic in the custom jobs section.
|
|
47
|
+
* Prefixes provide more flexibility than the boolean flags (testable, deployable, etc).
|
|
48
|
+
*
|
|
49
|
+
* @example ['test', 'deploy', 'remote-test']
|
|
50
|
+
* @example ['lint', 'build', 'test', 'deploy', 'e2e']
|
|
51
|
+
*/
|
|
52
|
+
prefixes?: string[];
|
|
37
53
|
/**
|
|
38
54
|
* Whether this domain has tests that should be run.
|
|
39
55
|
* If true, generates test jobs for this domain.
|
|
40
56
|
* @default false
|
|
57
|
+
* @deprecated Use `prefixes: ['test']` instead for more flexibility
|
|
41
58
|
*/
|
|
42
59
|
testable?: boolean;
|
|
43
60
|
/**
|
|
44
61
|
* Whether this domain should be deployed.
|
|
45
62
|
* If true, generates deployment jobs for this domain.
|
|
46
63
|
* @default false
|
|
64
|
+
* @deprecated Use `prefixes: ['deploy']` instead for more flexibility
|
|
47
65
|
*/
|
|
48
66
|
deployable?: boolean;
|
|
49
67
|
/**
|
|
50
68
|
* Whether this domain should be tested remotely after deployment.
|
|
51
69
|
* If true, generates remote test jobs for this domain.
|
|
52
70
|
* @default false
|
|
71
|
+
* @deprecated Use `prefixes: ['remote-test']` instead for more flexibility
|
|
53
72
|
*/
|
|
54
73
|
remoteTestable?: boolean;
|
|
55
74
|
}
|
|
56
75
|
/**
|
|
57
76
|
* Complete PipeCraft configuration schema.
|
|
58
77
|
*
|
|
59
|
-
* This is the main configuration interface loaded from `.pipecraftrc
|
|
60
|
-
* the `pipecraft` key in `package.json`.
|
|
61
|
-
* behavior including branch flow, merge
|
|
62
|
-
* versioning, and automated actions.
|
|
78
|
+
* This is the main configuration interface loaded from `.pipecraftrc` (YAML or JSON),
|
|
79
|
+
* `.pipecraftrc.json` (legacy), or the `pipecraft` key in `package.json`.
|
|
80
|
+
* It defines the entire CI/CD pipeline behavior including branch flow, merge
|
|
81
|
+
* strategies, domain configuration, versioning, and automated actions.
|
|
63
82
|
*
|
|
64
83
|
* @example
|
|
65
84
|
* ```typescript
|
|
@@ -70,7 +89,7 @@ export interface DomainConfig {
|
|
|
70
89
|
* initialBranch: 'develop',
|
|
71
90
|
* finalBranch: 'main',
|
|
72
91
|
* branchFlow: ['develop', 'staging', 'main'],
|
|
73
|
-
*
|
|
92
|
+
* autoPromote: { staging: true },
|
|
74
93
|
* semver: {
|
|
75
94
|
* bumpRules: { feat: 'minor', fix: 'patch', breaking: 'major' }
|
|
76
95
|
* },
|
|
@@ -120,14 +139,16 @@ export interface PipecraftConfig {
|
|
|
120
139
|
*/
|
|
121
140
|
branchFlow: string[];
|
|
122
141
|
/**
|
|
123
|
-
* Auto-
|
|
124
|
-
* - boolean: Enable/disable auto-
|
|
125
|
-
* - Record: Per-branch auto-
|
|
142
|
+
* Auto-promote configuration for branch promotions.
|
|
143
|
+
* - boolean: Enable/disable auto-promotion for all branches
|
|
144
|
+
* - Record: Per-branch auto-promote settings (e.g., `{ staging: true, main: false }`)
|
|
126
145
|
*
|
|
127
|
-
* When enabled,
|
|
146
|
+
* When enabled, code is automatically promoted (fast-forwarded) to the next branch
|
|
147
|
+
* in the flow after checks pass. When disabled, a PR is created for manual review
|
|
148
|
+
* and the promotion happens when the PR is merged.
|
|
128
149
|
* @default false
|
|
129
150
|
*/
|
|
130
|
-
|
|
151
|
+
autoPromote?: boolean | Record<string, boolean>;
|
|
131
152
|
/**
|
|
132
153
|
* Git merge method for auto-merge operations.
|
|
133
154
|
* - 'auto': Use fast-forward when possible, merge otherwise
|
|
@@ -168,57 +189,46 @@ export interface PipecraftConfig {
|
|
|
168
189
|
domains: Record<string, DomainConfig>;
|
|
169
190
|
/**
|
|
170
191
|
* Package manager used for dependency installation.
|
|
171
|
-
* Auto-detected during init based on lockfile presence.
|
|
172
|
-
*
|
|
173
|
-
* - 'npm': Uses npm (with package-lock.json)
|
|
174
|
-
* - 'yarn': Uses yarn (with yarn.lock)
|
|
175
|
-
* - 'pnpm': Uses pnpm (with pnpm-lock.yaml)
|
|
176
192
|
*
|
|
177
|
-
* @
|
|
193
|
+
* @deprecated This field is no longer used by PipeCraft workflows.
|
|
194
|
+
* It was originally intended for JavaScript/Node.js projects but
|
|
195
|
+
* PipeCraft now supports language-agnostic workflows. Existing
|
|
196
|
+
* configs with this field will continue to work, but it has no effect.
|
|
178
197
|
*/
|
|
179
198
|
packageManager?: 'npm' | 'yarn' | 'pnpm';
|
|
180
199
|
/**
|
|
181
|
-
*
|
|
182
|
-
* When enabled, PipeCraft generates workflows that leverage Nx's dependency graph
|
|
183
|
-
* and affected detection for intelligent change-based testing.
|
|
200
|
+
* How workflows should reference PipeCraft actions.
|
|
184
201
|
*
|
|
202
|
+
* - 'local': Actions copied to ./.github/actions/ (default, full control)
|
|
203
|
+
* - 'remote': Reference published marketplace actions (e.g., the-craftlab/pipecraft/actions/detect-changes@v1)
|
|
204
|
+
* - 'source': Use ./actions/ from repo root (internal use only, for PipeCraft's own CI)
|
|
205
|
+
*
|
|
206
|
+
* @default 'local'
|
|
185
207
|
* @example
|
|
186
208
|
* ```typescript
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
209
|
+
* // User repos (local mode)
|
|
210
|
+
* actionSourceMode: 'local'
|
|
211
|
+
* // Generates: uses: ./.github/actions/detect-changes
|
|
212
|
+
*
|
|
213
|
+
* // User repos (remote mode)
|
|
214
|
+
* actionSourceMode: 'remote'
|
|
215
|
+
* actionVersion: 'v1.2.3'
|
|
216
|
+
* // Generates: uses: the-craftlab/pipecraft/actions/detect-changes@v1.2.3
|
|
217
|
+
*
|
|
218
|
+
* // PipeCraft repo only (source mode)
|
|
219
|
+
* actionSourceMode: 'source'
|
|
220
|
+
* // Generates: uses: ./actions/detect-changes
|
|
192
221
|
* ```
|
|
193
222
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
*
|
|
204
|
-
* @example ['lint', 'test', 'build', 'e2e']
|
|
205
|
-
*/
|
|
206
|
-
tasks: string[];
|
|
207
|
-
/**
|
|
208
|
-
* Base git reference for affected detection.
|
|
209
|
-
* Used in `nx affected --base=<baseRef>`.
|
|
210
|
-
*
|
|
211
|
-
* @default 'origin/main'
|
|
212
|
-
*/
|
|
213
|
-
baseRef?: string;
|
|
214
|
-
/**
|
|
215
|
-
* Whether to include Nx cache management in workflows.
|
|
216
|
-
* Speeds up subsequent runs by caching build outputs.
|
|
217
|
-
*
|
|
218
|
-
* @default true
|
|
219
|
-
*/
|
|
220
|
-
enableCache?: boolean;
|
|
221
|
-
};
|
|
223
|
+
actionSourceMode?: 'local' | 'remote' | 'source';
|
|
224
|
+
/**
|
|
225
|
+
* Version/tag to use when actionSourceMode is 'remote'.
|
|
226
|
+
* Pins workflows to a specific marketplace action version.
|
|
227
|
+
*
|
|
228
|
+
* @example 'v1.2.3', 'v1', 'main'
|
|
229
|
+
* @default 'v1'
|
|
230
|
+
*/
|
|
231
|
+
actionVersion?: string;
|
|
222
232
|
/**
|
|
223
233
|
* Idempotency and rebuild configuration.
|
|
224
234
|
* Controls when workflows should be regenerated based on config/template changes.
|
|
@@ -286,8 +296,9 @@ export interface PipecraftConfig {
|
|
|
286
296
|
changelog: boolean;
|
|
287
297
|
/**
|
|
288
298
|
* Mapping of commit types to version bump levels.
|
|
299
|
+
* @deprecated Use semver.bumpRules instead. This field is ignored if semver.bumpRules is present.
|
|
289
300
|
*/
|
|
290
|
-
bumpRules
|
|
301
|
+
bumpRules?: Record<string, string>;
|
|
291
302
|
};
|
|
292
303
|
}
|
|
293
304
|
/**
|
|
@@ -334,6 +345,7 @@ export interface PipecraftContext {
|
|
|
334
345
|
domains: Record<string, {
|
|
335
346
|
paths: string[];
|
|
336
347
|
description: string;
|
|
348
|
+
prefixes?: string[];
|
|
337
349
|
testable?: boolean;
|
|
338
350
|
deployable?: boolean;
|
|
339
351
|
remoteTestable?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;IAEf;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;IAEf;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IAEn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