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
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module templates/actions/promote-branch.yml.tpl
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import fs from 'fs';
|
|
9
|
+
import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
11
10
|
import dedent from 'dedent';
|
|
11
|
+
import fs from 'fs';
|
|
12
12
|
import { logger } from '../../utils/logger.js';
|
|
13
|
+
import { getActionOutputDir, shouldGenerateActions } from '../../utils/action-reference.js';
|
|
13
14
|
/**
|
|
14
15
|
* Generates the promote-branch composite action YAML content.
|
|
15
16
|
*
|
|
@@ -26,6 +27,9 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
26
27
|
description: 'Source branch to promote from (defaults to github.ref_name)'
|
|
27
28
|
required: false
|
|
28
29
|
default: \${{ github.ref_name }}
|
|
30
|
+
targetBranch:
|
|
31
|
+
description: 'Target branch to promote to'
|
|
32
|
+
required: true
|
|
29
33
|
version:
|
|
30
34
|
description: 'Version being promoted (e.g., v1.2.3, auto-detected from git tags if not provided)'
|
|
31
35
|
required: false
|
|
@@ -34,10 +38,10 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
34
38
|
description: 'The original run number from develop branch for traceability'
|
|
35
39
|
required: false
|
|
36
40
|
default: ''
|
|
37
|
-
|
|
38
|
-
description: '
|
|
41
|
+
autoPromote:
|
|
42
|
+
description: 'Whether to automatically promote (fast-forward) to the target branch'
|
|
39
43
|
required: false
|
|
40
|
-
default: '
|
|
44
|
+
default: 'false'
|
|
41
45
|
tempBranchPattern:
|
|
42
46
|
description: 'Pattern for temp branch name'
|
|
43
47
|
required: false
|
|
@@ -57,12 +61,6 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
57
61
|
tempBranch:
|
|
58
62
|
description: 'The temporary branch name'
|
|
59
63
|
value: \${{ steps.create-temp.outputs.tempBranch }}
|
|
60
|
-
targetBranch:
|
|
61
|
-
description: 'The target branch determined from config'
|
|
62
|
-
value: \${{ steps.read-config.outputs.targetBranch }}
|
|
63
|
-
autoMerge:
|
|
64
|
-
description: 'The autoMerge setting for the target branch'
|
|
65
|
-
value: \${{ steps.read-config.outputs.autoMerge }}
|
|
66
64
|
|
|
67
65
|
runs:
|
|
68
66
|
using: 'composite'
|
|
@@ -73,55 +71,6 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
73
71
|
fetch-depth: 0
|
|
74
72
|
token: \${{ inputs.token }}
|
|
75
73
|
|
|
76
|
-
- name: Read Config and Determine Target Branch
|
|
77
|
-
id: read-config
|
|
78
|
-
shell: bash
|
|
79
|
-
run: |
|
|
80
|
-
SOURCE="\${{ inputs.sourceBranch }}"
|
|
81
|
-
CONFIG_PATH="\${{ inputs.configPath }}"
|
|
82
|
-
|
|
83
|
-
echo "📖 Reading config from \$CONFIG_PATH"
|
|
84
|
-
|
|
85
|
-
# Check if config file exists
|
|
86
|
-
if [ ! -f "\$CONFIG_PATH" ]; then
|
|
87
|
-
echo "❌ Config file not found: \$CONFIG_PATH"
|
|
88
|
-
exit 1
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
|
-
# Read branchFlow array from config
|
|
92
|
-
BRANCH_FLOW=\$(cat "\$CONFIG_PATH" | jq -r '.branchFlow | join(" ")')
|
|
93
|
-
echo "🔍 Branch flow: \$BRANCH_FLOW"
|
|
94
|
-
|
|
95
|
-
# Convert to array
|
|
96
|
-
IFS=' ' read -ra BRANCHES <<< "\$BRANCH_FLOW"
|
|
97
|
-
|
|
98
|
-
# Find current branch index and determine target
|
|
99
|
-
TARGET=""
|
|
100
|
-
for i in "\${!BRANCHES[@]}"; do
|
|
101
|
-
if [ "\${BRANCHES[\$i]}" == "\$SOURCE" ]; then
|
|
102
|
-
# Get next branch in flow
|
|
103
|
-
NEXT_INDEX=\$((i + 1))
|
|
104
|
-
if [ \$NEXT_INDEX -lt \${#BRANCHES[@]} ]; then
|
|
105
|
-
TARGET="\${BRANCHES[\$NEXT_INDEX]}"
|
|
106
|
-
fi
|
|
107
|
-
break
|
|
108
|
-
fi
|
|
109
|
-
done
|
|
110
|
-
|
|
111
|
-
if [ -z "\$TARGET" ]; then
|
|
112
|
-
echo "❌ Could not determine target branch for source: \$SOURCE"
|
|
113
|
-
echo " Branch flow: \$BRANCH_FLOW"
|
|
114
|
-
exit 1
|
|
115
|
-
fi
|
|
116
|
-
|
|
117
|
-
echo "✅ Target branch: \$TARGET"
|
|
118
|
-
echo "targetBranch=\$TARGET" >> \$GITHUB_OUTPUT
|
|
119
|
-
|
|
120
|
-
# Determine autoMerge setting for target branch
|
|
121
|
-
AUTO_MERGE=\$(cat "\$CONFIG_PATH" | jq -r ".autoMerge.\"\$TARGET\" // false")
|
|
122
|
-
echo "🔍 Auto-merge for \$TARGET: \$AUTO_MERGE"
|
|
123
|
-
echo "autoMerge=\$AUTO_MERGE" >> \$GITHUB_OUTPUT
|
|
124
|
-
|
|
125
74
|
- name: Get Version
|
|
126
75
|
id: get-version
|
|
127
76
|
shell: bash
|
|
@@ -144,7 +93,7 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
144
93
|
shell: bash
|
|
145
94
|
run: |
|
|
146
95
|
SOURCE="\${{ inputs.sourceBranch }}"
|
|
147
|
-
TARGET="\${{
|
|
96
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
148
97
|
VERSION="\${{ steps.get-version.outputs.version }}"
|
|
149
98
|
PATTERN="\${{ inputs.tempBranchPattern }}"
|
|
150
99
|
|
|
@@ -189,7 +138,7 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
189
138
|
GH_TOKEN: \${{ inputs.token }}
|
|
190
139
|
run: |
|
|
191
140
|
TEMP_BRANCH="\${{ steps.create-temp.outputs.tempBranch }}"
|
|
192
|
-
TARGET="\${{
|
|
141
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
193
142
|
|
|
194
143
|
# Check if PR already exists from temp branch to target
|
|
195
144
|
EXISTING_PR=\$(gh pr list --head "\$TEMP_BRANCH" --base "\$TARGET" --json number --jq '.[0].number' 2>/dev/null || echo "")
|
|
@@ -215,15 +164,15 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
215
164
|
GH_TOKEN: \${{ inputs.token }}
|
|
216
165
|
run: |
|
|
217
166
|
TEMP_BRANCH="\${{ steps.create-temp.outputs.tempBranch }}"
|
|
218
|
-
TARGET="\${{
|
|
167
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
219
168
|
SOURCE="\${{ inputs.sourceBranch }}"
|
|
220
169
|
VERSION="\${{ steps.get-version.outputs.version }}"
|
|
221
|
-
|
|
170
|
+
AUTO_PROMOTE="\${{ inputs.autoPromote }}"
|
|
222
171
|
|
|
223
172
|
TITLE="🚀 Release \$VERSION to \$TARGET"
|
|
224
173
|
|
|
225
174
|
# Determine merge behavior text
|
|
226
|
-
if [ "\$
|
|
175
|
+
if [ "\$AUTO_PROMOTE" == "true" ]; then
|
|
227
176
|
MERGE_TEXT="merge automatically"
|
|
228
177
|
else
|
|
229
178
|
MERGE_TEXT="require manual approval"
|
|
@@ -257,30 +206,25 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
257
206
|
exit 1
|
|
258
207
|
fi
|
|
259
208
|
|
|
260
|
-
- name:
|
|
261
|
-
if:
|
|
209
|
+
- name: Manual Merge Required
|
|
210
|
+
if: inputs.autoPromote == 'false'
|
|
262
211
|
shell: bash
|
|
263
|
-
env:
|
|
264
|
-
GH_TOKEN: \${{ inputs.token }}
|
|
265
212
|
run: |
|
|
266
213
|
PR_NUMBER="\${{ steps.check-pr.outputs.prNumber || steps.create-pr.outputs.prNumber }}"
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
echo "🔐 Enabling auto-merge with rebase for PR #\$PR_NUMBER (requires approval)"
|
|
270
|
-
echo " This will fast-forward \$TARGET when approved, maintaining linear history"
|
|
214
|
+
PR_URL="\${{ steps.check-pr.outputs.prUrl || steps.create-pr.outputs.prUrl }}"
|
|
271
215
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
echo "
|
|
276
|
-
echo "
|
|
216
|
+
echo "✅ PR #\$PR_NUMBER created successfully"
|
|
217
|
+
echo "🔗 URL: \$PR_URL"
|
|
218
|
+
echo ""
|
|
219
|
+
echo "⚠️ Auto-merge is disabled for this branch."
|
|
220
|
+
echo " Please review and merge the PR manually when ready."
|
|
277
221
|
|
|
278
222
|
- name: Fast-Forward Merge (Immediate Auto-Merge)
|
|
279
|
-
if:
|
|
223
|
+
if: inputs.autoPromote == 'true'
|
|
280
224
|
shell: bash
|
|
281
225
|
run: |
|
|
282
226
|
SOURCE="\${{ inputs.sourceBranch }}"
|
|
283
|
-
TARGET="\${{
|
|
227
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
284
228
|
VERSION="\${{ steps.get-version.outputs.version }}"
|
|
285
229
|
|
|
286
230
|
echo "🚀 Fast-forwarding \$TARGET to \$SOURCE (maintaining linear history)"
|
|
@@ -314,7 +258,7 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
314
258
|
echo "📝 PR will be closed automatically for audit trail"
|
|
315
259
|
|
|
316
260
|
- name: Wait for Branch to Propagate
|
|
317
|
-
if:
|
|
261
|
+
if: inputs.autoPromote == 'true'
|
|
318
262
|
shell: bash
|
|
319
263
|
run: |
|
|
320
264
|
echo "⏳ Waiting 5 seconds for branch update to propagate..."
|
|
@@ -322,12 +266,12 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
322
266
|
echo "✅ Branch should be fully propagated"
|
|
323
267
|
|
|
324
268
|
- name: Trigger Pipeline Workflow on Target Branch
|
|
325
|
-
if:
|
|
269
|
+
if: inputs.autoPromote == 'true'
|
|
326
270
|
shell: bash
|
|
327
271
|
env:
|
|
328
272
|
GH_TOKEN: \${{ inputs.token }}
|
|
329
273
|
run: |
|
|
330
|
-
TARGET="\${{
|
|
274
|
+
TARGET="\${{ inputs.targetBranch }}"
|
|
331
275
|
VERSION="\${{ steps.get-version.outputs.version }}"
|
|
332
276
|
RUN_NUMBER="\${{ inputs.run_number }}"
|
|
333
277
|
|
|
@@ -352,7 +296,7 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
352
296
|
echo "✅ Pipeline workflow triggered on \$TARGET with version \$VERSION at commit \$COMMIT_SHA"
|
|
353
297
|
|
|
354
298
|
- name: Close PR and Delete Branch
|
|
355
|
-
if:
|
|
299
|
+
if: inputs.autoPromote == 'true'
|
|
356
300
|
shell: bash
|
|
357
301
|
env:
|
|
358
302
|
GH_TOKEN: \${{ inputs.token }}
|
|
@@ -383,7 +327,7 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
383
327
|
echo "ℹ️ Using existing PR #\$PR_NUMBER"
|
|
384
328
|
echo "🔗 URL: \$PR_URL"
|
|
385
329
|
|
|
386
|
-
# Note: Fast-forward merge happens in separate step if
|
|
330
|
+
# Note: Fast-forward merge happens in separate step if autoPromote is enabled
|
|
387
331
|
`;
|
|
388
332
|
};
|
|
389
333
|
/**
|
|
@@ -392,14 +336,17 @@ const promoteBranchActionTemplate = (ctx) => {
|
|
|
392
336
|
* @param {PinionContext} ctx - Pinion generator context
|
|
393
337
|
* @returns {Promise<PinionContext>} Updated context after file generation
|
|
394
338
|
*/
|
|
395
|
-
export const generate = (ctx) => Promise.resolve(ctx)
|
|
396
|
-
.
|
|
397
|
-
|
|
398
|
-
|
|
339
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(ctx => {
|
|
340
|
+
const config = ctx.config || {};
|
|
341
|
+
if (!shouldGenerateActions(config)) {
|
|
342
|
+
logger.verbose('Skipping promote-branch action generation (using remote actions)');
|
|
343
|
+
return ctx;
|
|
344
|
+
}
|
|
345
|
+
const outputDir = getActionOutputDir(config);
|
|
346
|
+
const filePath = `${outputDir}/promote-branch/action.yml`;
|
|
399
347
|
const exists = fs.existsSync(filePath);
|
|
400
348
|
const status = exists ? '🔄 Merged with existing' : '📝 Created new';
|
|
401
349
|
logger.verbose(`${status} ${filePath}`);
|
|
402
|
-
return ctx;
|
|
403
|
-
})
|
|
404
|
-
.then(renderTemplate(promoteBranchActionTemplate, toFile('.github/actions/promote-branch/action.yml')));
|
|
350
|
+
return renderTemplate(promoteBranchActionTemplate, toFile(filePath))(ctx);
|
|
351
|
+
});
|
|
405
352
|
//# sourceMappingURL=promote-branch.yml.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promote-branch.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/promote-branch.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"promote-branch.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/promote-branch.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAsB,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAG3F;;;;;GAKG;AACH,MAAM,2BAA2B,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC/C,OAAO,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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version":3,"file":"release-it.cjs.tpl.d.ts","sourceRoot":"","sources":["../../src/templates/release-it.cjs.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAmHlF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,iBAUrC,CAAA"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @module templates/release-it.cjs.tpl
|
|
14
14
|
*/
|
|
15
|
-
import {
|
|
15
|
+
import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
16
16
|
import { logger } from '../utils/logger.js';
|
|
17
17
|
/**
|
|
18
18
|
* Generate release-it configuration content
|
|
@@ -26,32 +26,30 @@ import { logger } from '../utils/logger.js';
|
|
|
26
26
|
* @returns {string} JavaScript configuration content
|
|
27
27
|
*/
|
|
28
28
|
const releaseItTemplate = (ctx) => {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
// Base default prefixes for conventional commits
|
|
30
|
+
const baseDefaults = {
|
|
31
|
+
test: 'ignore',
|
|
32
|
+
build: 'ignore',
|
|
33
|
+
ci: 'patch',
|
|
34
|
+
docs: 'patch',
|
|
35
|
+
chore: 'minor',
|
|
36
|
+
style: 'patch',
|
|
31
37
|
fix: 'patch',
|
|
32
|
-
|
|
38
|
+
perf: 'patch',
|
|
39
|
+
refactor: 'patch',
|
|
40
|
+
feat: 'minor',
|
|
41
|
+
major: 'major'
|
|
33
42
|
};
|
|
34
|
-
//
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
// Get user-defined bump rules from config
|
|
44
|
+
const userBumpRules = ctx.config?.semver?.bumpRules || ctx.semver?.bumpRules || {};
|
|
45
|
+
// Merge user rules with defaults (user rules take precedence)
|
|
46
|
+
const mergedRules = { ...baseDefaults, ...userBumpRules };
|
|
47
|
+
// Convert to formatted string for the config file
|
|
48
|
+
const rulesEntries = Object.entries(mergedRules)
|
|
49
|
+
.map(([type, level]) => ` ${type}: '${level}'`)
|
|
50
|
+
.join(',\n');
|
|
41
51
|
return `const DEFAULT_PREFIXES = {
|
|
42
|
-
|
|
43
|
-
build: 'ignore',
|
|
44
|
-
|
|
45
|
-
ci: 'patch',
|
|
46
|
-
docs: 'patch',
|
|
47
|
-
chore: 'minor',
|
|
48
|
-
style: 'patch',
|
|
49
|
-
fix: 'patch',
|
|
50
|
-
perf: 'patch',
|
|
51
|
-
refactor: 'patch',
|
|
52
|
-
|
|
53
|
-
feat: 'minor',
|
|
54
|
-
major: 'major',
|
|
52
|
+
${rulesEntries}
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
module.exports = {
|
|
@@ -72,7 +70,7 @@ module.exports = {
|
|
|
72
70
|
"skipChecks": true
|
|
73
71
|
},
|
|
74
72
|
"hooks": {
|
|
75
|
-
|
|
73
|
+
'after:release': "echo \${version} > .release-version"
|
|
76
74
|
},
|
|
77
75
|
|
|
78
76
|
|
|
@@ -90,7 +88,16 @@ module.exports = {
|
|
|
90
88
|
let breakings = 0
|
|
91
89
|
let features = 0
|
|
92
90
|
let levelSet = ['major','minor','patch','ignore']
|
|
93
|
-
|
|
91
|
+
|
|
92
|
+
// Handle empty commits array - return null to skip release
|
|
93
|
+
if (!commits || commits.length === 0) {
|
|
94
|
+
return {
|
|
95
|
+
level: null,
|
|
96
|
+
reason: 'No commits found - skipping release'
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
let levels = commits.map(commit => {
|
|
94
101
|
let level = levelSet.indexOf(types[commit.type])
|
|
95
102
|
level = level<0?3:level
|
|
96
103
|
if (commit.notes.length > 0) {
|
|
@@ -100,7 +107,9 @@ module.exports = {
|
|
|
100
107
|
features += 1;
|
|
101
108
|
}
|
|
102
109
|
return level
|
|
103
|
-
})
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
let level = Math.min.apply(Math, levels)
|
|
104
113
|
return {
|
|
105
114
|
level: level,
|
|
106
115
|
reason: breakings === 1
|
|
@@ -137,12 +146,12 @@ module.exports = {
|
|
|
137
146
|
* ```
|
|
138
147
|
*/
|
|
139
148
|
export const generate = (ctx) => Promise.resolve(ctx)
|
|
140
|
-
.then(
|
|
149
|
+
.then(ctx => {
|
|
141
150
|
logger.verbose('📝 Generating release-it configuration...');
|
|
142
151
|
return ctx;
|
|
143
152
|
})
|
|
144
153
|
.then(renderTemplate((ctx) => releaseItTemplate(ctx), toFile('.release-it.cjs')))
|
|
145
|
-
.then(
|
|
154
|
+
.then(ctx => {
|
|
146
155
|
logger.verbose('✅ Generated .release-it.cjs');
|
|
147
156
|
return ctx;
|
|
148
157
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-it.cjs.tpl.js","sourceRoot":"","sources":["../../src/templates/release-it.cjs.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"release-it.cjs.tpl.js","sourceRoot":"","sources":["../../src/templates/release-it.cjs.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAsB,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAQ,EAAE,EAAE;IACrC,iDAAiD;IACjD,MAAM,YAAY,GAA2B;QAC3C,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;QACf,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,OAAO;QACjB,IAAI,EA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.ts","sourceRoot":"","sources":["../../../src/templates/workflows/enforce-pr-target.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,aAAa,EAA0B,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"enforce-pr-target.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/workflows/enforce-pr-target.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAElF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,iBAiCxC,CAAA"}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* })
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
import {
|
|
29
|
+
import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
30
30
|
/**
|
|
31
31
|
* Generates the enforce-pr-target.yml workflow file.
|
|
32
32
|
*
|
|
@@ -49,8 +49,7 @@ import { toFile, renderTemplate } from '@featherscloud/pinion';
|
|
|
49
49
|
* // Creates: .github/workflows/enforce-pr-target.yml
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
|
-
export const generate = (ctx) => Promise.resolve(ctx)
|
|
53
|
-
.then(renderTemplate((ctx) => {
|
|
52
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(renderTemplate((ctx) => {
|
|
54
53
|
const { initialBranch = 'develop', finalBranch = 'main' } = ctx;
|
|
55
54
|
return `name: Enforce PR Target Branch
|
|
56
55
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enforce-pr-target.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/workflows/enforce-pr-target.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"enforce-pr-target.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/workflows/enforce-pr-target.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAsB,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAElF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAkB,EAAE,EAAE,CAC7C,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CACvB,cAAc,CAAC,CAAC,GAAQ,EAAE,EAAE;IAC1B,MAAM,EAAE,aAAa,GAAG,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,GAAG,GAAG,CAAA;IAE/D,OAAO;;;;;;;;;;;kCAWqB,WAAW;;sDAES,aAAa,kBAAkB,WAAW;6DACnC,aAAa;;;;;8CAK5B,WAAW,SAAS,aAAa;;;;kCAI7C,aAAa;;0CAEL,aAAa;CACtD,CAAA;AACG,CAAC,EAAE,MAAM,CAAC,yCAAyC,CAAC,CAAC,CACtD,CAAA"}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Uses shared operations architecture for maintainability and consistency with Nx template.
|
|
8
8
|
*/
|
|
9
|
-
import { PinionContext } from '@featherscloud/pinion';
|
|
10
|
-
import { PipecraftConfig } from '../../types/index.js';
|
|
9
|
+
import { type PinionContext } from '@featherscloud/pinion';
|
|
10
|
+
import type { PipecraftConfig } from '../../types/index.js';
|
|
11
11
|
interface PathBasedPipelineContext extends PinionContext {
|
|
12
12
|
config: PipecraftConfig;
|
|
13
13
|
branchFlow: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/workflows/pipeline.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAA0B,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"pipeline.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/workflows/pipeline.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAGlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAe3D,UAAU,wBAAyB,SAAQ,aAAa;IACtD,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAiKD;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,wBAAwB,iBA+RjD,CAAA"}
|