pipecraft 0.29.2 → 0.36.2
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 +98 -34
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +66 -24
- 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 +369 -79
- 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 -24
- 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 +16 -9
- 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 +9 -6
- 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 +9 -6
- 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 +9 -6
- package/dist/templates/actions/create-tag.yml.tpl.js.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts +24 -52
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.js +281 -108
- 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 +9 -6
- 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 +27 -76
- package/dist/templates/actions/promote-branch.yml.tpl.js.map +1 -1
- package/dist/templates/actions/run-nx-affected.yml.tpl.d.ts +33 -0
- package/dist/templates/actions/run-nx-affected.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/run-nx-affected.yml.tpl.js +346 -0
- package/dist/templates/actions/run-nx-affected.yml.tpl.js.map +1 -0
- 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 +24 -26
- 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-nx.yml.tpl.d.ts +2 -2
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js +300 -93
- package/dist/templates/workflows/pipeline-nx.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 +347 -74
- 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 +3 -2
- package/dist/templates/workflows/shared/index.d.ts.map +1 -1
- package/dist/templates/workflows/shared/index.js +3 -2
- package/dist/templates/workflows/shared/index.js.map +1 -1
- package/dist/templates/workflows/shared/operations-changes.d.ts +13 -2
- package/dist/templates/workflows/shared/operations-changes.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-changes.js +47 -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 +143 -19
- package/dist/templates/workflows/shared/operations-domain-jobs.js.map +1 -1
- package/dist/templates/workflows/shared/operations-gate.d.ts +32 -0
- package/dist/templates/workflows/shared/operations-gate.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-gate.js +77 -0
- package/dist/templates/workflows/shared/operations-gate.js.map +1 -0
- package/dist/templates/workflows/shared/operations-header.d.ts +1 -1
- package/dist/templates/workflows/shared/operations-header.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-header.js +46 -6
- package/dist/templates/workflows/shared/operations-header.js.map +1 -1
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts +5 -1
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-tag-promote.js +138 -31
- package/dist/templates/workflows/shared/operations-tag-promote.js.map +1 -1
- package/dist/templates/workflows/shared/operations-version.d.ts +3 -1
- package/dist/templates/workflows/shared/operations-version.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-version.js +18 -10
- 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.map +1 -1
- package/dist/types/index.d.ts +57 -4
- 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 +11 -5
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +33 -8
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/github-setup.d.ts +4 -4
- package/dist/utils/github-setup.d.ts.map +1 -1
- package/dist/utils/github-setup.js +57 -36
- 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.map +1 -1
- package/dist/utils/messaging.js +7 -3
- 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/package.json +11 -4
- package/src/generators/init.tpl.ts +434 -96
- package/src/generators/workflows.tpl.ts +54 -45
- 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/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
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* })
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
import {
|
|
28
|
+
import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
29
29
|
/**
|
|
30
30
|
* Generates the pr-title-check.yml workflow file.
|
|
31
31
|
*
|
|
@@ -48,14 +48,40 @@ import { toFile, renderTemplate } from '@featherscloud/pinion';
|
|
|
48
48
|
* // Creates: .github/workflows/pr-title-check.yml
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
export const generate = (ctx) => Promise.resolve(ctx)
|
|
52
|
-
.then((ctx) => {
|
|
51
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(ctx => {
|
|
53
52
|
const { requireConventionalCommits = true } = ctx;
|
|
54
53
|
// Only generate if conventional commits are required
|
|
55
54
|
if (!requireConventionalCommits) {
|
|
56
55
|
return ctx;
|
|
57
56
|
}
|
|
58
|
-
return renderTemplate((ctx) =>
|
|
57
|
+
return renderTemplate((ctx) => {
|
|
58
|
+
// Get all commit types from bumpRules config
|
|
59
|
+
const bumpRules = ctx.config?.semver?.bumpRules || ctx.config?.versioning?.bumpRules || {};
|
|
60
|
+
const allTypes = Object.keys(bumpRules);
|
|
61
|
+
// Get major bump types for breaking change detection
|
|
62
|
+
const majorTypes = Object.entries(bumpRules)
|
|
63
|
+
.filter(([_, level]) => level === 'major')
|
|
64
|
+
.map(([type, _]) => type);
|
|
65
|
+
// Build the types list for the PR title validator
|
|
66
|
+
// Use config types, or fall back to common conventional commit types
|
|
67
|
+
const typesList = allTypes.length > 0
|
|
68
|
+
? allTypes.map(type => ` ${type}`).join('\n')
|
|
69
|
+
: ` fix
|
|
70
|
+
feat
|
|
71
|
+
docs
|
|
72
|
+
style
|
|
73
|
+
chore
|
|
74
|
+
refactor
|
|
75
|
+
perf
|
|
76
|
+
test
|
|
77
|
+
ci
|
|
78
|
+
build
|
|
79
|
+
revert
|
|
80
|
+
major`;
|
|
81
|
+
// Build regex pattern for detecting major bump types
|
|
82
|
+
// Format: ^(major|breaking|othermajortype):
|
|
83
|
+
const majorTypesPattern = majorTypes.length > 0 ? `^(${majorTypes.join('|')}):` : '^major:';
|
|
84
|
+
return `name: "PR Title Format Check"
|
|
59
85
|
|
|
60
86
|
on:
|
|
61
87
|
pull_request:
|
|
@@ -66,7 +92,8 @@ on:
|
|
|
66
92
|
- reopened
|
|
67
93
|
|
|
68
94
|
permissions:
|
|
69
|
-
pull-requests:
|
|
95
|
+
pull-requests: write
|
|
96
|
+
contents: read
|
|
70
97
|
|
|
71
98
|
jobs:
|
|
72
99
|
main:
|
|
@@ -79,22 +106,40 @@ jobs:
|
|
|
79
106
|
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
80
107
|
with:
|
|
81
108
|
# Configure which types are allowed (newline-delimited).
|
|
82
|
-
#
|
|
109
|
+
# Types are derived from pipecraft config bumpRules
|
|
83
110
|
types: |
|
|
84
|
-
|
|
85
|
-
feat
|
|
86
|
-
docs
|
|
87
|
-
style
|
|
88
|
-
chore
|
|
89
|
-
refactor
|
|
90
|
-
perf
|
|
91
|
-
test
|
|
92
|
-
ci
|
|
93
|
-
build
|
|
94
|
-
revert
|
|
95
|
-
major
|
|
111
|
+
${typesList}
|
|
96
112
|
requireScope: false
|
|
97
113
|
|
|
114
|
+
# Check for breaking changes
|
|
115
|
+
- name: Check for breaking changes
|
|
116
|
+
id: breaking_check
|
|
117
|
+
if: always()
|
|
118
|
+
env:
|
|
119
|
+
PR_TITLE: \${{ github.event.pull_request.title }}
|
|
120
|
+
PR_BODY: \${{ github.event.pull_request.body }}
|
|
121
|
+
run: |
|
|
122
|
+
|
|
123
|
+
# Check if title starts with types that bump major version or contains "!" or "BREAKING"
|
|
124
|
+
# Types that bump major: ${majorTypes.join(', ')}
|
|
125
|
+
${majorTypes.length > 0
|
|
126
|
+
? `IS_MAJOR_TYPE=false
|
|
127
|
+
for type in ${majorTypes.map(t => `"${t}"`).join(' ')}; do
|
|
128
|
+
if [[ "$PR_TITLE" =~ ^$type: ]]; then
|
|
129
|
+
IS_MAJOR_TYPE=true
|
|
130
|
+
break
|
|
131
|
+
fi
|
|
132
|
+
done
|
|
133
|
+
if [ "$IS_MAJOR_TYPE" = "true" ] || [[ "$PR_TITLE" =~ ^[a-z]+!: ]] || [[ "$PR_TITLE" =~ BREAKING ]] || [[ "$PR_TITLE" =~ breaking ]]; then`
|
|
134
|
+
: `if [[ "$PR_TITLE" =~ ^major: ]] || [[ "$PR_TITLE" =~ ^[a-z]+!: ]] || [[ "$PR_TITLE" =~ BREAKING ]] || [[ "$PR_TITLE" =~ breaking ]]; then`}
|
|
135
|
+
echo "is_breaking=true" >> $GITHUB_OUTPUT
|
|
136
|
+
echo "⚠️ Breaking change detected in PR title"
|
|
137
|
+
elif [[ "$PR_BODY" =~ BREAKING[[:space:]]CHANGE ]]; then
|
|
138
|
+
echo "is_breaking=true" >> $GITHUB_OUTPUT
|
|
139
|
+
echo "⚠️ Breaking change detected in PR body"
|
|
140
|
+
else
|
|
141
|
+
echo "is_breaking=false" >> $GITHUB_OUTPUT
|
|
142
|
+
fi
|
|
98
143
|
|
|
99
144
|
- uses: marocchino/sticky-pull-request-comment@v2
|
|
100
145
|
# When the previous steps fails, the workflow would stop. By adding this
|
|
@@ -104,11 +149,11 @@ jobs:
|
|
|
104
149
|
header: pr-title-lint-error
|
|
105
150
|
message: |
|
|
106
151
|
Hey there and thank you for opening this pull request! 👋🏼
|
|
107
|
-
|
|
152
|
+
|
|
108
153
|
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
|
|
109
154
|
|
|
110
155
|
Details:
|
|
111
|
-
|
|
156
|
+
|
|
112
157
|
\`\`\`
|
|
113
158
|
\${{ steps.lint_pr_title.outputs.error_message }}
|
|
114
159
|
\`\`\`
|
|
@@ -116,8 +161,42 @@ jobs:
|
|
|
116
161
|
# Delete a previous comment when the issue has been resolved
|
|
117
162
|
- if: \${{ steps.lint_pr_title.outputs.error_message == null }}
|
|
118
163
|
uses: marocchino/sticky-pull-request-comment@v2
|
|
119
|
-
with:
|
|
164
|
+
with:
|
|
120
165
|
header: pr-title-lint-error
|
|
121
|
-
delete: true
|
|
166
|
+
delete: true
|
|
167
|
+
|
|
168
|
+
# Add warning comment for breaking changes
|
|
169
|
+
- name: Add breaking change warning
|
|
170
|
+
if: always() && steps.breaking_check.outputs.is_breaking == 'true'
|
|
171
|
+
uses: marocchino/sticky-pull-request-comment@v2
|
|
172
|
+
with:
|
|
173
|
+
header: breaking-change-warning
|
|
174
|
+
message: |
|
|
175
|
+
## ⚠️ BREAKING CHANGE DETECTED
|
|
176
|
+
|
|
177
|
+
This PR contains a **BREAKING CHANGE** which will result in a **MAJOR version bump**.
|
|
178
|
+
|
|
179
|
+
**Important considerations:**
|
|
180
|
+
- Breaking changes require careful review by maintainers
|
|
181
|
+
- This will increment the major version (e.g., 1.x.x → 2.0.0)
|
|
182
|
+
- Users will need to update their code when upgrading
|
|
183
|
+
- Documentation should be updated to reflect the breaking changes
|
|
184
|
+
- Consider if this change can be made backwards-compatible
|
|
185
|
+
|
|
186
|
+
**Required actions:**
|
|
187
|
+
- [ ] Breaking changes are documented in the PR description
|
|
188
|
+
- [ ] Migration guide is provided (if applicable)
|
|
189
|
+
- [ ] All maintainers have been notified for review
|
|
190
|
+
|
|
191
|
+
**Reviewers:** This PR requires additional scrutiny due to the breaking change.
|
|
192
|
+
|
|
193
|
+
# Delete breaking change warning when resolved
|
|
194
|
+
- name: Remove breaking change warning
|
|
195
|
+
if: always() && steps.breaking_check.outputs.is_breaking == 'false'
|
|
196
|
+
uses: marocchino/sticky-pull-request-comment@v2
|
|
197
|
+
with:
|
|
198
|
+
header: breaking-change-warning
|
|
199
|
+
delete: true`;
|
|
200
|
+
}, toFile('.github/workflows/pr-title-check.yml'))(ctx);
|
|
122
201
|
});
|
|
123
202
|
//# sourceMappingURL=pr-title-check.yml.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-title-check.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/workflows/pr-title-check.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"pr-title-check.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/workflows/pr-title-check.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;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,CAAC,GAAG,CAAC,EAAE;IAC9B,MAAM,EAAE,0BAA0B,GAAG,IAAI,EAAE,GAAG,GAAU,CAAA;IAExD,qDAAqD;IACrD,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAChC,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,OAAO,cAAc,CAAC,CAAC,GAAQ,EAAE,EAAE;QACjC,6CAA6C;QAC7C,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,IAAI,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,IAAI,EAAE,CAAA;QAC1F,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEvC,qDAAqD;QACrD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;aACzC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,OAAO,CAAC;aACzC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;QAE3B,kDAAkD;QAClD,qEAAqE;QACrE,MAAM,SAAS,GACb,QAAQ,CAAC,MAAM,GAAG,CAAC;YACjB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACxD,CAAC,CAAC;;;;;;;;;;;kBAWM,CAAA;QAEZ,qDAAqD;QACrD,4CAA4C;QAC5C,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;QAE3F,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BX,SAAS;;;;;;;;;;;;;qCAa0B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;YAE9C,UAAU,CAAC,MAAM,GAAG,CAAC;YACnB,CAAC,CAAC;wBACQ,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;;;;;;qJAMsF;YACvI,CAAC,CAAC,2IACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAiEa,CAAA;IACnB,CAAC,EAAE,MAAM,CAAC,sCAAsC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACzD,CAAC,CAAC,CAAA"}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Export all shared operation generators for building workflow templates.
|
|
5
5
|
*/
|
|
6
|
-
export * from './operations-header.js';
|
|
7
6
|
export * from './operations-changes.js';
|
|
8
7
|
export * from './operations-domain-jobs.js';
|
|
9
|
-
export * from './operations-
|
|
8
|
+
export * from './operations-gate.js';
|
|
9
|
+
export * from './operations-header.js';
|
|
10
10
|
export * from './operations-tag-promote.js';
|
|
11
|
+
export * from './operations-version.js';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA"}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Export all shared operation generators for building workflow templates.
|
|
5
5
|
*/
|
|
6
|
-
export * from './operations-header.js';
|
|
7
6
|
export * from './operations-changes.js';
|
|
8
7
|
export * from './operations-domain-jobs.js';
|
|
9
|
-
export * from './operations-
|
|
8
|
+
export * from './operations-gate.js';
|
|
9
|
+
export * from './operations-header.js';
|
|
10
10
|
export * from './operations-tag-promote.js';
|
|
11
|
+
export * from './operations-version.js';
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA"}
|
|
@@ -3,15 +3,26 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates the changes detection job that identifies which domains have changed.
|
|
5
5
|
* Supports both Nx-based detection (using dependency graph) and path-based detection.
|
|
6
|
+
*
|
|
7
|
+
* **Pipeline-Embedded Approach:**
|
|
8
|
+
* - Domain definitions are BAKED INTO the pipeline file at generation time
|
|
9
|
+
* - The detect-changes action is generic and reusable
|
|
10
|
+
* - When domains change in .pipecraftrc, regenerate to update the pipeline
|
|
11
|
+
* - Actions themselves never change
|
|
6
12
|
*/
|
|
7
|
-
import { PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
13
|
+
import { type PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
14
|
+
import type { PipecraftConfig } from '../../../types/index.js';
|
|
8
15
|
export interface ChangesContext {
|
|
9
16
|
domains: Record<string, any>;
|
|
10
17
|
useNx?: boolean;
|
|
11
18
|
baseRef?: string;
|
|
19
|
+
config?: Partial<PipecraftConfig>;
|
|
12
20
|
}
|
|
13
21
|
/**
|
|
14
|
-
* Create the changes detection job operation
|
|
22
|
+
* Create the changes detection job operation.
|
|
23
|
+
*
|
|
24
|
+
* Embeds domain configuration directly into the pipeline YAML at generation time.
|
|
25
|
+
* The detect-changes action receives this as structured input.
|
|
15
26
|
*/
|
|
16
27
|
export declare function createChangesJobOperation(ctx: ChangesContext): PathOperationConfig;
|
|
17
28
|
//# sourceMappingURL=operations-changes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations-changes.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-changes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"operations-changes.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAE9D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,cAAc,GAAG,mBAAmB,CA+DlF"}
|
|
@@ -3,46 +3,77 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates the changes detection job that identifies which domains have changed.
|
|
5
5
|
* Supports both Nx-based detection (using dependency graph) and path-based detection.
|
|
6
|
+
*
|
|
7
|
+
* **Pipeline-Embedded Approach:**
|
|
8
|
+
* - Domain definitions are BAKED INTO the pipeline file at generation time
|
|
9
|
+
* - The detect-changes action is generic and reusable
|
|
10
|
+
* - When domains change in .pipecraftrc, regenerate to update the pipeline
|
|
11
|
+
* - Actions themselves never change
|
|
6
12
|
*/
|
|
7
13
|
import { createValueFromString } from '../../../utils/ast-path-operations.js';
|
|
14
|
+
import { getActionReference } from '../../../utils/action-reference.js';
|
|
8
15
|
/**
|
|
9
|
-
* Create the changes detection job operation
|
|
16
|
+
* Create the changes detection job operation.
|
|
17
|
+
*
|
|
18
|
+
* Embeds domain configuration directly into the pipeline YAML at generation time.
|
|
19
|
+
* The detect-changes action receives this as structured input.
|
|
10
20
|
*/
|
|
11
21
|
export function createChangesJobOperation(ctx) {
|
|
12
|
-
const { domains, useNx = false, baseRef = 'main' } = ctx;
|
|
13
|
-
const action = useNx ? 'detect-changes-nx' : 'detect-changes';
|
|
22
|
+
const { domains, useNx = false, baseRef = 'main', config = {} } = ctx;
|
|
14
23
|
const sortedDomains = Object.keys(domains).sort();
|
|
24
|
+
// Get the action reference based on configuration
|
|
25
|
+
const actionRef = getActionReference('detect-changes', config);
|
|
15
26
|
const comment = `
|
|
16
27
|
=============================================================================
|
|
17
|
-
CHANGES DETECTION (⚠️ Managed by Pipecraft - do not modify)
|
|
28
|
+
CHANGES DETECTION (⚠️ Managed by Pipecraft - do not modify)
|
|
18
29
|
=============================================================================
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
30
|
+
This job detects which domains have changed.
|
|
31
|
+
Domain definitions are baked into this file at generation time.
|
|
32
|
+
Run 'pipecraft generate' to update when domains change in .pipecraftrc.
|
|
22
33
|
`;
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
// Generate individual domain outputs by parsing the JSON changes output
|
|
35
|
+
const outputsSection = sortedDomains
|
|
36
|
+
.map(domain => ` ${domain}: \${{ fromJSON(steps.detect.outputs.changes).${domain} }}`)
|
|
37
|
+
.join('\n');
|
|
38
|
+
// Build domain configuration as YAML that will be embedded in the pipeline
|
|
39
|
+
// This gets regenerated when running pipecraft generate
|
|
40
|
+
const domainsYaml = sortedDomains
|
|
41
|
+
.map(domainName => {
|
|
42
|
+
const domain = domains[domainName];
|
|
43
|
+
const pathsYaml = domain.paths.map((path) => ` - '${path}'`).join('\n');
|
|
44
|
+
return ` ${domainName}:\n paths:\n${pathsYaml}`;
|
|
45
|
+
})
|
|
46
|
+
.join('\n');
|
|
28
47
|
return {
|
|
29
48
|
path: 'jobs.changes',
|
|
30
49
|
operation: 'overwrite',
|
|
50
|
+
spaceBefore: true,
|
|
31
51
|
commentBefore: comment,
|
|
32
52
|
value: createValueFromString(`
|
|
33
53
|
runs-on: ubuntu-latest
|
|
54
|
+
env:
|
|
55
|
+
# Domain configuration (regenerated by pipecraft generate)
|
|
56
|
+
DOMAINS: |
|
|
57
|
+
${domainsYaml}
|
|
34
58
|
steps:
|
|
35
59
|
- uses: actions/checkout@v4
|
|
36
60
|
with:
|
|
37
61
|
ref: \${{ inputs.commitSha || github.sha }}
|
|
38
|
-
fetch-depth:
|
|
39
|
-
- uses:
|
|
62
|
+
fetch-depth: \${{ env.FETCH_DEPTH_AFFECTED }}
|
|
63
|
+
- uses: ${actionRef}
|
|
40
64
|
id: detect
|
|
41
65
|
with:
|
|
42
|
-
baseRef: \${{ inputs.baseRef || '${baseRef}' }}
|
|
66
|
+
baseRef: \${{ inputs.baseRef || '${baseRef}' }}
|
|
67
|
+
domains-config: \${{ env.DOMAINS }}
|
|
68
|
+
useNx: '${useNx ? 'true' : 'false'}'
|
|
69
|
+
node-version: \${{ env.NODE_VERSION }}
|
|
70
|
+
pnpm-version: \${{ env.PNPM_VERSION }}
|
|
43
71
|
outputs:
|
|
44
72
|
${outputsSection}
|
|
45
|
-
|
|
73
|
+
changes: \${{ steps.detect.outputs.changes }}
|
|
74
|
+
affectedDomains: \${{ steps.detect.outputs.affectedDomains }}
|
|
75
|
+
nxAvailable: \${{ steps.detect.outputs.nxAvailable }}
|
|
76
|
+
affectedProjects: \${{ steps.detect.outputs.affectedProjects }}
|
|
46
77
|
`)
|
|
47
78
|
};
|
|
48
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations-changes.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-changes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"operations-changes.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,qBAAqB,EAEtB,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAUvE;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAmB;IAC3D,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,GAAG,CAAA;IACrE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAA;IAEjD,kDAAkD;IAClD,MAAM,SAAS,GAAG,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;IAE9D,MAAM,OAAO,GAAG;;;;;;;CAOjB,CAAA;IAEC,wEAAwE;IACxE,MAAM,cAAc,GAAG,aAAa;SACjC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,MAAM,iDAAiD,MAAM,KAAK,CAAC;SAC1F,IAAI,CAAC,IAAI,CAAC,CAAA;IAEb,2EAA2E;IAC3E,wDAAwD;IACxD,MAAM,WAAW,GAAG,aAAa;SAC9B,GAAG,CAAC,UAAU,CAAC,EAAE;QAChB,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;QAClC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,oBAAoB,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC5F,OAAO,eAAe,UAAU,4BAA4B,SAAS,EAAE,CAAA;IACzE,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;IAEb,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,WAAW;QACtB,WAAW,EAAE,IAAI;QACjB,aAAa,EAAE,OAAO;QACtB,KAAK,EAAE,qBAAqB,CAAC;;;;;EAK/B,WAAW;;;;;;gBAMG,SAAS;;;6CAGoB,OAAO;;oBAEhC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;;;;EAI1C,cAAc;;;;;GAKb,CAAC;KACD,CAAA;AACH,CAAC"}
|
|
@@ -4,10 +4,21 @@
|
|
|
4
4
|
* Generates test, deploy, and remote-test jobs for each domain.
|
|
5
5
|
* These jobs are marked as 'preserve' so users can customize them.
|
|
6
6
|
*/
|
|
7
|
-
import { PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
7
|
+
import { type PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
8
8
|
export interface DomainJobsContext {
|
|
9
9
|
domains: Record<string, any>;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Create placeholder job operations for domains with custom prefixes
|
|
13
|
+
*
|
|
14
|
+
* Generates jobs based on the `prefixes` field in domain config.
|
|
15
|
+
* For example, with domain 'core' and prefixes ['lint', 'build', 'test'],
|
|
16
|
+
* this creates: lint-core, build-core, test-core
|
|
17
|
+
*
|
|
18
|
+
* @param ctx Context with domain configurations
|
|
19
|
+
* @returns Array of path operations for all prefix-based jobs
|
|
20
|
+
*/
|
|
21
|
+
export declare function createPrefixedDomainJobOperations(ctx: DomainJobsContext): PathOperationConfig[];
|
|
11
22
|
/**
|
|
12
23
|
* Create test job operations for each domain
|
|
13
24
|
*/
|
|
@@ -22,10 +33,16 @@ export declare function createDomainDeployJobOperations(ctx: DomainJobsContext):
|
|
|
22
33
|
export declare function createDomainRemoteTestJobOperations(ctx: DomainJobsContext): PathOperationConfig[];
|
|
23
34
|
/**
|
|
24
35
|
* Get list of all domain job names for dependency management
|
|
36
|
+
*
|
|
37
|
+
* Supports both legacy boolean flags (testable, deployable, remoteTestable)
|
|
38
|
+
* and new flexible prefixes array.
|
|
39
|
+
*
|
|
40
|
+
* @returns Object with arrays of job names categorized by type
|
|
25
41
|
*/
|
|
26
42
|
export declare function getDomainJobNames(domains: Record<string, any>): {
|
|
27
43
|
testJobs: string[];
|
|
28
44
|
deployJobs: string[];
|
|
29
45
|
remoteTestJobs: string[];
|
|
46
|
+
allJobsByPrefix: Record<string, string[]>;
|
|
30
47
|
};
|
|
31
48
|
//# sourceMappingURL=operations-domain-jobs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations-domain-jobs.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-domain-jobs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"operations-domain-jobs.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-domain-jobs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,uCAAuC,CAAA;AAE9C,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,iBAAiB,GAAG,mBAAmB,EAAE,CAwD/F;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,iBAAiB,GAAG,mBAAmB,EAAE,CAyC3F;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,iBAAiB,GAAG,mBAAmB,EAAE,CAyC7F;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,iBAAiB,GAAG,mBAAmB,EAAE,CAyCjG;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAC/D,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CAC1C,CA+DA"}
|
|
@@ -5,13 +5,76 @@
|
|
|
5
5
|
* These jobs are marked as 'preserve' so users can customize them.
|
|
6
6
|
*/
|
|
7
7
|
import { createValueFromString } from '../../../utils/ast-path-operations.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create placeholder job operations for domains with custom prefixes
|
|
10
|
+
*
|
|
11
|
+
* Generates jobs based on the `prefixes` field in domain config.
|
|
12
|
+
* For example, with domain 'core' and prefixes ['lint', 'build', 'test'],
|
|
13
|
+
* this creates: lint-core, build-core, test-core
|
|
14
|
+
*
|
|
15
|
+
* @param ctx Context with domain configurations
|
|
16
|
+
* @returns Array of path operations for all prefix-based jobs
|
|
17
|
+
*/
|
|
18
|
+
export function createPrefixedDomainJobOperations(ctx) {
|
|
19
|
+
const { domains } = ctx;
|
|
20
|
+
const operations = [];
|
|
21
|
+
// Group jobs by prefix to add section comments
|
|
22
|
+
const jobsByPrefix = {};
|
|
23
|
+
Object.keys(domains)
|
|
24
|
+
.sort()
|
|
25
|
+
.forEach(domain => {
|
|
26
|
+
const domainConfig = domains[domain];
|
|
27
|
+
// Only process domains with prefixes defined
|
|
28
|
+
if (domainConfig.prefixes && Array.isArray(domainConfig.prefixes)) {
|
|
29
|
+
domainConfig.prefixes.forEach((prefix) => {
|
|
30
|
+
if (!jobsByPrefix[prefix]) {
|
|
31
|
+
jobsByPrefix[prefix] = [];
|
|
32
|
+
}
|
|
33
|
+
jobsByPrefix[prefix].push({
|
|
34
|
+
domain,
|
|
35
|
+
jobName: `${prefix}-${domain}`
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
// Generate operations for each prefix group
|
|
41
|
+
Object.keys(jobsByPrefix)
|
|
42
|
+
.sort()
|
|
43
|
+
.forEach(prefix => {
|
|
44
|
+
const jobs = jobsByPrefix[prefix];
|
|
45
|
+
jobs.forEach((job, index) => {
|
|
46
|
+
operations.push({
|
|
47
|
+
path: `jobs.${job.jobName}`,
|
|
48
|
+
operation: 'preserve', // User can customize these jobs - won't overwrite if exists
|
|
49
|
+
value: createValueFromString(`
|
|
50
|
+
needs: changes
|
|
51
|
+
if: \${{ needs.changes.outputs.${job.domain} == 'true' }}
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@v4
|
|
55
|
+
with:
|
|
56
|
+
ref: \${{ inputs.commitSha || github.sha }}
|
|
57
|
+
# TODO: Replace with your ${job.domain} ${prefix} logic
|
|
58
|
+
- name: Run ${prefix} for ${job.domain}
|
|
59
|
+
run: |
|
|
60
|
+
echo "Running ${prefix} for ${job.domain} domain"
|
|
61
|
+
echo "Replace this with your actual ${prefix} commands"
|
|
62
|
+
# Example: npm run ${prefix}:${job.domain}
|
|
63
|
+
`)
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
return operations;
|
|
68
|
+
}
|
|
8
69
|
/**
|
|
9
70
|
* Create test job operations for each domain
|
|
10
71
|
*/
|
|
11
72
|
export function createDomainTestJobOperations(ctx) {
|
|
12
73
|
const { domains } = ctx;
|
|
13
74
|
const operations = [];
|
|
14
|
-
const testableDomains = Object.keys(domains)
|
|
75
|
+
const testableDomains = Object.keys(domains)
|
|
76
|
+
.sort()
|
|
77
|
+
.filter(d => domains[d].testable !== false);
|
|
15
78
|
testableDomains.forEach((domain, index) => {
|
|
16
79
|
operations.push({
|
|
17
80
|
path: `jobs.test-${domain}`,
|
|
@@ -20,10 +83,10 @@ export function createDomainTestJobOperations(ctx) {
|
|
|
20
83
|
...(index === 0 && {
|
|
21
84
|
commentBefore: `
|
|
22
85
|
=============================================================================
|
|
23
|
-
TESTING JOBS (✅ Customize these with your test logic)
|
|
86
|
+
TESTING JOBS (✅ Customize these with your test logic)
|
|
24
87
|
=============================================================================
|
|
25
|
-
These jobs run tests for each domain when changes are detected.
|
|
26
|
-
Replace the TODO comments with your actual test commands.
|
|
88
|
+
These jobs run tests for each domain when changes are detected.
|
|
89
|
+
Replace the TODO comments with your actual test commands.
|
|
27
90
|
`
|
|
28
91
|
}),
|
|
29
92
|
value: createValueFromString(`
|
|
@@ -51,7 +114,9 @@ Replace the TODO comments with your actual test commands.
|
|
|
51
114
|
export function createDomainDeployJobOperations(ctx) {
|
|
52
115
|
const { domains } = ctx;
|
|
53
116
|
const operations = [];
|
|
54
|
-
const deployableDomains = Object.keys(domains)
|
|
117
|
+
const deployableDomains = Object.keys(domains)
|
|
118
|
+
.sort()
|
|
119
|
+
.filter(d => domains[d].deployable === true);
|
|
55
120
|
deployableDomains.forEach((domain, index) => {
|
|
56
121
|
operations.push({
|
|
57
122
|
path: `jobs.deploy-${domain}`,
|
|
@@ -60,10 +125,10 @@ export function createDomainDeployJobOperations(ctx) {
|
|
|
60
125
|
...(index === 0 && {
|
|
61
126
|
commentBefore: `
|
|
62
127
|
=============================================================================
|
|
63
|
-
DEPLOYMENT JOBS (✅ Customize these with your deploy logic)
|
|
128
|
+
DEPLOYMENT JOBS (✅ Customize these with your deploy logic)
|
|
64
129
|
=============================================================================
|
|
65
|
-
These jobs deploy each domain when changes are detected and tests pass.
|
|
66
|
-
Replace the TODO
|
|
130
|
+
These jobs deploy each domain when changes are detected and tests pass.
|
|
131
|
+
Replace the TODO commands with your actual deployment commands.
|
|
67
132
|
`
|
|
68
133
|
}),
|
|
69
134
|
value: createValueFromString(`
|
|
@@ -91,7 +156,9 @@ Replace the TODO comments with your actual deployment commands.
|
|
|
91
156
|
export function createDomainRemoteTestJobOperations(ctx) {
|
|
92
157
|
const { domains } = ctx;
|
|
93
158
|
const operations = [];
|
|
94
|
-
const remoteTestableDomains = Object.keys(domains)
|
|
159
|
+
const remoteTestableDomains = Object.keys(domains)
|
|
160
|
+
.sort()
|
|
161
|
+
.filter(d => domains[d].remoteTestable === true);
|
|
95
162
|
remoteTestableDomains.forEach((domain, index) => {
|
|
96
163
|
operations.push({
|
|
97
164
|
path: `jobs.remote-test-${domain}`,
|
|
@@ -100,15 +167,15 @@ export function createDomainRemoteTestJobOperations(ctx) {
|
|
|
100
167
|
...(index === 0 && {
|
|
101
168
|
commentBefore: `
|
|
102
169
|
=============================================================================
|
|
103
|
-
REMOTE TESTING JOBS (✅ Customize these with your remote test logic)
|
|
170
|
+
REMOTE TESTING JOBS (✅ Customize these with your remote test logic)
|
|
104
171
|
=============================================================================
|
|
105
|
-
These jobs test deployed services remotely after deployment succeeds.
|
|
106
|
-
Replace the TODO comments with your actual remote testing commands.
|
|
172
|
+
These jobs test deployed services remotely after deployment succeeds.
|
|
173
|
+
Replace the TODO comments with your actual remote testing commands.
|
|
107
174
|
`
|
|
108
175
|
}),
|
|
109
176
|
value: createValueFromString(`
|
|
110
177
|
needs: [ deploy-${domain}, changes ]
|
|
111
|
-
if: \${{
|
|
178
|
+
if: \${{ needs.changes.outputs.${domain} == 'true' && needs.deploy-${domain}.result == 'success' }}
|
|
112
179
|
runs-on: ubuntu-latest
|
|
113
180
|
steps:
|
|
114
181
|
- uses: actions/checkout@v4
|
|
@@ -116,7 +183,6 @@ Replace the TODO comments with your actual remote testing commands.
|
|
|
116
183
|
ref: \${{ inputs.commitSha || github.sha }}
|
|
117
184
|
# TODO: Replace with your ${domain} remote testing logic
|
|
118
185
|
- name: Test ${domain} remotely
|
|
119
|
-
if: \${{ needs.changes.outputs.${domain} == 'true' && needs.deploy-${domain}.result == 'success' }}
|
|
120
186
|
run: |
|
|
121
187
|
echo "Testing ${domain} remotely"
|
|
122
188
|
echo "Replace this with your actual remote test commands"
|
|
@@ -128,12 +194,70 @@ Replace the TODO comments with your actual remote testing commands.
|
|
|
128
194
|
}
|
|
129
195
|
/**
|
|
130
196
|
* Get list of all domain job names for dependency management
|
|
197
|
+
*
|
|
198
|
+
* Supports both legacy boolean flags (testable, deployable, remoteTestable)
|
|
199
|
+
* and new flexible prefixes array.
|
|
200
|
+
*
|
|
201
|
+
* @returns Object with arrays of job names categorized by type
|
|
131
202
|
*/
|
|
132
203
|
export function getDomainJobNames(domains) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
204
|
+
const testJobs = [];
|
|
205
|
+
const deployJobs = [];
|
|
206
|
+
const remoteTestJobs = [];
|
|
207
|
+
const allJobsByPrefix = {};
|
|
208
|
+
Object.keys(domains)
|
|
209
|
+
.sort()
|
|
210
|
+
.forEach(domain => {
|
|
211
|
+
const domainConfig = domains[domain];
|
|
212
|
+
// New approach: use prefixes if defined
|
|
213
|
+
if (domainConfig.prefixes && Array.isArray(domainConfig.prefixes)) {
|
|
214
|
+
domainConfig.prefixes.forEach((prefix) => {
|
|
215
|
+
const jobName = `${prefix}-${domain}`;
|
|
216
|
+
// Categorize by known prefixes for backwards compatibility
|
|
217
|
+
if (prefix === 'test') {
|
|
218
|
+
testJobs.push(jobName);
|
|
219
|
+
}
|
|
220
|
+
else if (prefix === 'deploy') {
|
|
221
|
+
deployJobs.push(jobName);
|
|
222
|
+
}
|
|
223
|
+
else if (prefix === 'remote-test') {
|
|
224
|
+
remoteTestJobs.push(jobName);
|
|
225
|
+
}
|
|
226
|
+
// Also track all jobs by prefix for flexible access
|
|
227
|
+
if (!allJobsByPrefix[prefix]) {
|
|
228
|
+
allJobsByPrefix[prefix] = [];
|
|
229
|
+
}
|
|
230
|
+
allJobsByPrefix[prefix].push(jobName);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
// Legacy approach: use boolean flags
|
|
235
|
+
if (domainConfig.testable !== false) {
|
|
236
|
+
const jobName = `test-${domain}`;
|
|
237
|
+
testJobs.push(jobName);
|
|
238
|
+
if (!allJobsByPrefix['test']) {
|
|
239
|
+
allJobsByPrefix['test'] = [];
|
|
240
|
+
}
|
|
241
|
+
allJobsByPrefix['test'].push(jobName);
|
|
242
|
+
}
|
|
243
|
+
if (domainConfig.deployable === true) {
|
|
244
|
+
const jobName = `deploy-${domain}`;
|
|
245
|
+
deployJobs.push(jobName);
|
|
246
|
+
if (!allJobsByPrefix['deploy']) {
|
|
247
|
+
allJobsByPrefix['deploy'] = [];
|
|
248
|
+
}
|
|
249
|
+
allJobsByPrefix['deploy'].push(jobName);
|
|
250
|
+
}
|
|
251
|
+
if (domainConfig.remoteTestable === true) {
|
|
252
|
+
const jobName = `remote-test-${domain}`;
|
|
253
|
+
remoteTestJobs.push(jobName);
|
|
254
|
+
if (!allJobsByPrefix['remote-test']) {
|
|
255
|
+
allJobsByPrefix['remote-test'] = [];
|
|
256
|
+
}
|
|
257
|
+
allJobsByPrefix['remote-test'].push(jobName);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
return { testJobs, deployJobs, remoteTestJobs, allJobsByPrefix };
|
|
138
262
|
}
|
|
139
263
|
//# sourceMappingURL=operations-domain-jobs.js.map
|