pipecraft 0.28.2 → 0.29.0
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 +5 -2
- package/dist/cli/index.js +1 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/init.tpl.d.ts.map +1 -1
- package/dist/generators/init.tpl.js +140 -67
- package/dist/generators/init.tpl.js.map +1 -1
- package/dist/generators/workflows.tpl.d.ts.map +1 -1
- package/dist/generators/workflows.tpl.js +18 -5
- package/dist/generators/workflows.tpl.js.map +1 -1
- package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts +32 -0
- package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/detect-changes-nx.yml.tpl.js +227 -0
- package/dist/templates/actions/detect-changes-nx.yml.tpl.js.map +1 -0
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts +22 -0
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts.map +1 -0
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js +196 -0
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js.map +1 -0
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts +22 -0
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts.map +1 -0
- package/dist/templates/workflows/pipeline.yml.tpl.js +136 -0
- package/dist/templates/workflows/pipeline.yml.tpl.js.map +1 -0
- package/dist/templates/workflows/shared/index.d.ts +11 -0
- package/dist/templates/workflows/shared/index.d.ts.map +1 -0
- package/dist/templates/workflows/shared/index.js +11 -0
- package/dist/templates/workflows/shared/index.js.map +1 -0
- package/dist/templates/workflows/shared/operations-changes.d.ts +17 -0
- package/dist/templates/workflows/shared/operations-changes.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-changes.js +49 -0
- package/dist/templates/workflows/shared/operations-changes.js.map +1 -0
- package/dist/templates/workflows/shared/operations-domain-jobs.d.ts +31 -0
- package/dist/templates/workflows/shared/operations-domain-jobs.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-domain-jobs.js +139 -0
- package/dist/templates/workflows/shared/operations-domain-jobs.js.map +1 -0
- package/dist/templates/workflows/shared/operations-header.d.ts +15 -0
- package/dist/templates/workflows/shared/operations-header.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-header.js +158 -0
- package/dist/templates/workflows/shared/operations-header.js.map +1 -0
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts +16 -0
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-tag-promote.js +115 -0
- package/dist/templates/workflows/shared/operations-tag-promote.js.map +1 -0
- package/dist/templates/workflows/shared/operations-version.d.ts +16 -0
- package/dist/templates/workflows/shared/operations-version.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-version.js +57 -0
- package/dist/templates/workflows/shared/operations-version.js.map +1 -0
- package/dist/templates/yaml-format-utils.d.ts +24 -0
- package/dist/templates/yaml-format-utils.d.ts.map +1 -0
- package/dist/templates/yaml-format-utils.js +50 -0
- package/dist/templates/yaml-format-utils.js.map +1 -0
- package/dist/types/index.d.ts +53 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/generators/init.tpl.ts +151 -73
- package/src/generators/workflows.tpl.ts +19 -5
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts +0 -129
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts.map +0 -1
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.js +0 -1057
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.js.map +0 -1
- package/dist/utils/github-setup-v2.d.ts +0 -15
- package/dist/utils/github-setup-v2.d.ts.map +0 -1
- package/dist/utils/github-setup-v2.js +0 -217
- package/dist/utils/github-setup-v2.js.map +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Pipeline Operations
|
|
3
|
+
*
|
|
4
|
+
* Export all shared operation generators for building workflow templates.
|
|
5
|
+
*/
|
|
6
|
+
export * from './operations-header.js';
|
|
7
|
+
export * from './operations-changes.js';
|
|
8
|
+
export * from './operations-domain-jobs.js';
|
|
9
|
+
export * from './operations-version.js';
|
|
10
|
+
export * from './operations-tag-promote.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Changes Detection Job Operations
|
|
3
|
+
*
|
|
4
|
+
* Generates the changes detection job that identifies which domains have changed.
|
|
5
|
+
* Supports both Nx-based detection (using dependency graph) and path-based detection.
|
|
6
|
+
*/
|
|
7
|
+
import { PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
8
|
+
export interface ChangesContext {
|
|
9
|
+
domains: Record<string, any>;
|
|
10
|
+
useNx?: boolean;
|
|
11
|
+
baseRef?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create the changes detection job operation
|
|
15
|
+
*/
|
|
16
|
+
export declare function createChangesJobOperation(ctx: ChangesContext): PathOperationConfig;
|
|
17
|
+
//# sourceMappingURL=operations-changes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations-changes.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-changes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAyB,MAAM,uCAAuC,CAAA;AAElG,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;CACjB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,cAAc,GAAG,mBAAmB,CA0ClF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Changes Detection Job Operations
|
|
3
|
+
*
|
|
4
|
+
* Generates the changes detection job that identifies which domains have changed.
|
|
5
|
+
* Supports both Nx-based detection (using dependency graph) and path-based detection.
|
|
6
|
+
*/
|
|
7
|
+
import { createValueFromString } from '../../../utils/ast-path-operations.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create the changes detection job operation
|
|
10
|
+
*/
|
|
11
|
+
export function createChangesJobOperation(ctx) {
|
|
12
|
+
const { domains, useNx = false, baseRef = 'main' } = ctx;
|
|
13
|
+
const action = useNx ? 'detect-changes-nx' : 'detect-changes';
|
|
14
|
+
const sortedDomains = Object.keys(domains).sort();
|
|
15
|
+
const comment = `
|
|
16
|
+
=============================================================================
|
|
17
|
+
CHANGES DETECTION (⚠️ Managed by Pipecraft - do not modify)
|
|
18
|
+
=============================================================================
|
|
19
|
+
${useNx
|
|
20
|
+
? 'Detects which domains have changed using Nx dependency graph and path-based fallback'
|
|
21
|
+
: 'Detects which domains have changed using path-based detection'}
|
|
22
|
+
`;
|
|
23
|
+
const outputsSection = sortedDomains.map(domain => ` ${domain}: \${{ steps.detect.outputs.${domain} }}`).join('\n');
|
|
24
|
+
const nxOutputs = useNx
|
|
25
|
+
? ` nxAvailable: \${{ steps.detect.outputs.nxAvailable }}
|
|
26
|
+
affectedProjects: \${{ steps.detect.outputs.affectedProjects }}`
|
|
27
|
+
: '';
|
|
28
|
+
return {
|
|
29
|
+
path: 'jobs.changes',
|
|
30
|
+
operation: 'overwrite',
|
|
31
|
+
commentBefore: comment,
|
|
32
|
+
value: createValueFromString(`
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v4
|
|
36
|
+
with:
|
|
37
|
+
ref: \${{ inputs.commitSha || github.sha }}
|
|
38
|
+
fetch-depth: 0
|
|
39
|
+
- uses: ./.github/actions/${action}
|
|
40
|
+
id: detect
|
|
41
|
+
with:
|
|
42
|
+
baseRef: \${{ inputs.baseRef || '${baseRef}' }}${useNx ? '\n useNx: \'true\'' : ''}
|
|
43
|
+
outputs:
|
|
44
|
+
${outputsSection}
|
|
45
|
+
${nxOutputs}
|
|
46
|
+
`)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=operations-changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations-changes.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-changes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAuB,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAQlG;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAmB;IAC3D,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,GAAG,CAAA;IACxD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAA;IAC7D,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAA;IAEjD,MAAM,OAAO,GAAG;;;;EAIhB,KAAK;QACH,CAAC,CAAC,sFAAsF;QACxF,CAAC,CAAC,+DACN;CACC,CAAA;IAEC,MAAM,cAAc,GAAG,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,MAAM,+BAA+B,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAExH,MAAM,SAAS,GAAG,KAAK;QACrB,CAAC,CAAC;sEACgE;QAClE,CAAC,CAAC,EAAE,CAAA;IAEN,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,WAAW;QACtB,aAAa,EAAE,OAAO;QACtB,KAAK,EAAE,qBAAqB,CAAC;;;;;;;kCAOC,MAAM;;;6CAGK,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,EAAE;;EAEnG,cAAc;EACd,SAAS;GACR,CAAC;KACD,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Domain Job Operations
|
|
3
|
+
*
|
|
4
|
+
* Generates test, deploy, and remote-test jobs for each domain.
|
|
5
|
+
* These jobs are marked as 'preserve' so users can customize them.
|
|
6
|
+
*/
|
|
7
|
+
import { PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
8
|
+
export interface DomainJobsContext {
|
|
9
|
+
domains: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create test job operations for each domain
|
|
13
|
+
*/
|
|
14
|
+
export declare function createDomainTestJobOperations(ctx: DomainJobsContext): PathOperationConfig[];
|
|
15
|
+
/**
|
|
16
|
+
* Create deploy job operations for deployable domains
|
|
17
|
+
*/
|
|
18
|
+
export declare function createDomainDeployJobOperations(ctx: DomainJobsContext): PathOperationConfig[];
|
|
19
|
+
/**
|
|
20
|
+
* Create remote test job operations for remotely testable domains
|
|
21
|
+
*/
|
|
22
|
+
export declare function createDomainRemoteTestJobOperations(ctx: DomainJobsContext): PathOperationConfig[];
|
|
23
|
+
/**
|
|
24
|
+
* Get list of all domain job names for dependency management
|
|
25
|
+
*/
|
|
26
|
+
export declare function getDomainJobNames(domains: Record<string, any>): {
|
|
27
|
+
testJobs: string[];
|
|
28
|
+
deployJobs: string[];
|
|
29
|
+
remoteTestJobs: string[];
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=operations-domain-jobs.d.ts.map
|
|
@@ -0,0 +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,EAAE,mBAAmB,EAAyB,MAAM,uCAAuC,CAAA;AAElG,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC7B;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,iBAAiB,GAAG,mBAAmB,EAAE,CAuC3F;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,iBAAiB,GAAG,mBAAmB,EAAE,CAuC7F;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,iBAAiB,GAAG,mBAAmB,EAAE,CAwCjG;AAED;;GAEG;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;CACzB,CAMA"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Domain Job Operations
|
|
3
|
+
*
|
|
4
|
+
* Generates test, deploy, and remote-test jobs for each domain.
|
|
5
|
+
* These jobs are marked as 'preserve' so users can customize them.
|
|
6
|
+
*/
|
|
7
|
+
import { createValueFromString } from '../../../utils/ast-path-operations.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create test job operations for each domain
|
|
10
|
+
*/
|
|
11
|
+
export function createDomainTestJobOperations(ctx) {
|
|
12
|
+
const { domains } = ctx;
|
|
13
|
+
const operations = [];
|
|
14
|
+
const testableDomains = Object.keys(domains).sort().filter(d => domains[d].testable !== false);
|
|
15
|
+
testableDomains.forEach((domain, index) => {
|
|
16
|
+
operations.push({
|
|
17
|
+
path: `jobs.test-${domain}`,
|
|
18
|
+
operation: 'preserve', // User can customize this job!
|
|
19
|
+
// Only add comment to the first test job
|
|
20
|
+
...(index === 0 && {
|
|
21
|
+
commentBefore: `
|
|
22
|
+
=============================================================================
|
|
23
|
+
TESTING JOBS (✅ Customize these with your test logic)
|
|
24
|
+
=============================================================================
|
|
25
|
+
These jobs run tests for each domain when changes are detected.
|
|
26
|
+
Replace the TODO comments with your actual test commands.
|
|
27
|
+
`
|
|
28
|
+
}),
|
|
29
|
+
value: createValueFromString(`
|
|
30
|
+
needs: changes
|
|
31
|
+
if: \${{ needs.changes.outputs.${domain} == 'true' }}
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
with:
|
|
36
|
+
ref: \${{ inputs.commitSha || github.sha }}
|
|
37
|
+
# TODO: Replace with your ${domain} test logic
|
|
38
|
+
- name: Run ${domain} tests
|
|
39
|
+
run: |
|
|
40
|
+
echo "Running tests for ${domain} domain"
|
|
41
|
+
echo "Replace this with your actual test commands"
|
|
42
|
+
# Example: npm test -- --testPathPattern=${domain}
|
|
43
|
+
`)
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
return operations;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create deploy job operations for deployable domains
|
|
50
|
+
*/
|
|
51
|
+
export function createDomainDeployJobOperations(ctx) {
|
|
52
|
+
const { domains } = ctx;
|
|
53
|
+
const operations = [];
|
|
54
|
+
const deployableDomains = Object.keys(domains).sort().filter(d => domains[d].deployable === true);
|
|
55
|
+
deployableDomains.forEach((domain, index) => {
|
|
56
|
+
operations.push({
|
|
57
|
+
path: `jobs.deploy-${domain}`,
|
|
58
|
+
operation: 'preserve', // User can customize this job!
|
|
59
|
+
// Only add comment to the first deploy job
|
|
60
|
+
...(index === 0 && {
|
|
61
|
+
commentBefore: `
|
|
62
|
+
=============================================================================
|
|
63
|
+
DEPLOYMENT JOBS (✅ Customize these with your deploy logic)
|
|
64
|
+
=============================================================================
|
|
65
|
+
These jobs deploy each domain when changes are detected and tests pass.
|
|
66
|
+
Replace the TODO comments with your actual deployment commands.
|
|
67
|
+
`
|
|
68
|
+
}),
|
|
69
|
+
value: createValueFromString(`
|
|
70
|
+
needs: [ version, changes ]
|
|
71
|
+
if: \${{ always() && needs.version.result == 'success' && needs.changes.outputs.${domain} == 'true' }}
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/checkout@v4
|
|
75
|
+
with:
|
|
76
|
+
ref: \${{ inputs.commitSha || github.sha }}
|
|
77
|
+
# TODO: Replace with your ${domain} deployment logic
|
|
78
|
+
- name: Deploy ${domain}
|
|
79
|
+
run: |
|
|
80
|
+
echo "Deploying ${domain} with version \${{ needs.version.outputs.version }}"
|
|
81
|
+
echo "Replace this with your actual deploy commands"
|
|
82
|
+
# Example: npm run deploy:${domain}
|
|
83
|
+
`)
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
return operations;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Create remote test job operations for remotely testable domains
|
|
90
|
+
*/
|
|
91
|
+
export function createDomainRemoteTestJobOperations(ctx) {
|
|
92
|
+
const { domains } = ctx;
|
|
93
|
+
const operations = [];
|
|
94
|
+
const remoteTestableDomains = Object.keys(domains).sort().filter(d => domains[d].remoteTestable === true);
|
|
95
|
+
remoteTestableDomains.forEach((domain, index) => {
|
|
96
|
+
operations.push({
|
|
97
|
+
path: `jobs.remote-test-${domain}`,
|
|
98
|
+
operation: 'preserve', // User can customize this job!
|
|
99
|
+
// Only add comment to the first remote test job
|
|
100
|
+
...(index === 0 && {
|
|
101
|
+
commentBefore: `
|
|
102
|
+
=============================================================================
|
|
103
|
+
REMOTE TESTING JOBS (✅ Customize these with your remote test logic)
|
|
104
|
+
=============================================================================
|
|
105
|
+
These jobs test deployed services remotely after deployment succeeds.
|
|
106
|
+
Replace the TODO comments with your actual remote testing commands.
|
|
107
|
+
`
|
|
108
|
+
}),
|
|
109
|
+
value: createValueFromString(`
|
|
110
|
+
needs: [ deploy-${domain}, changes ]
|
|
111
|
+
if: \${{ always() }}
|
|
112
|
+
runs-on: ubuntu-latest
|
|
113
|
+
steps:
|
|
114
|
+
- uses: actions/checkout@v4
|
|
115
|
+
with:
|
|
116
|
+
ref: \${{ inputs.commitSha || github.sha }}
|
|
117
|
+
# TODO: Replace with your ${domain} remote testing logic
|
|
118
|
+
- name: Test ${domain} remotely
|
|
119
|
+
if: \${{ needs.changes.outputs.${domain} == 'true' && needs.deploy-${domain}.result == 'success' }}
|
|
120
|
+
run: |
|
|
121
|
+
echo "Testing ${domain} remotely"
|
|
122
|
+
echo "Replace this with your actual remote test commands"
|
|
123
|
+
# Example: npm run test:remote:${domain}
|
|
124
|
+
`)
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
return operations;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get list of all domain job names for dependency management
|
|
131
|
+
*/
|
|
132
|
+
export function getDomainJobNames(domains) {
|
|
133
|
+
return {
|
|
134
|
+
testJobs: Object.keys(domains).sort().filter(d => domains[d].testable !== false).map(d => `test-${d}`),
|
|
135
|
+
deployJobs: Object.keys(domains).sort().filter(d => domains[d].deployable === true).map(d => `deploy-${d}`),
|
|
136
|
+
remoteTestJobs: Object.keys(domains).sort().filter(d => domains[d].remoteTestable === true).map(d => `remote-test-${d}`)
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=operations-domain-jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations-domain-jobs.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-domain-jobs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAuB,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAMlG;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAA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C,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtG,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3G,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;KACzH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Header Operations
|
|
3
|
+
*
|
|
4
|
+
* Generates workflow header operations (name, run-name, on triggers) that are
|
|
5
|
+
* common to both Nx and path-based pipeline templates.
|
|
6
|
+
*/
|
|
7
|
+
import { PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
8
|
+
export interface HeaderContext {
|
|
9
|
+
branchFlow: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create workflow header operations (name, run-name, on triggers)
|
|
13
|
+
*/
|
|
14
|
+
export declare function createHeaderOperations(ctx: HeaderContext): PathOperationConfig[];
|
|
15
|
+
//# sourceMappingURL=operations-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations-header.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-header.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAG3E,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,aAAa,GAAG,mBAAmB,EAAE,CA2JhF"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Header Operations
|
|
3
|
+
*
|
|
4
|
+
* Generates workflow header operations (name, run-name, on triggers) that are
|
|
5
|
+
* common to both Nx and path-based pipeline templates.
|
|
6
|
+
*/
|
|
7
|
+
import { Scalar } from 'yaml';
|
|
8
|
+
/**
|
|
9
|
+
* Create workflow header operations (name, run-name, on triggers)
|
|
10
|
+
*/
|
|
11
|
+
export function createHeaderOperations(ctx) {
|
|
12
|
+
const { branchFlow } = ctx;
|
|
13
|
+
// Provide sensible defaults if branchFlow is invalid
|
|
14
|
+
const validBranchFlow = (branchFlow && Array.isArray(branchFlow) && branchFlow.length > 0) ? branchFlow : ['main'];
|
|
15
|
+
const branchList = validBranchFlow.join(',');
|
|
16
|
+
return [
|
|
17
|
+
// =============================================================================
|
|
18
|
+
// WORKFLOW NAME
|
|
19
|
+
// =============================================================================
|
|
20
|
+
{
|
|
21
|
+
path: 'name',
|
|
22
|
+
operation: 'preserve',
|
|
23
|
+
value: (() => {
|
|
24
|
+
const nameScalar = new Scalar('Pipeline');
|
|
25
|
+
nameScalar.type = Scalar.QUOTE_DOUBLE;
|
|
26
|
+
return nameScalar;
|
|
27
|
+
})(),
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
// =============================================================================
|
|
31
|
+
// RUN NAME - Display name for workflow runs
|
|
32
|
+
// =============================================================================
|
|
33
|
+
{
|
|
34
|
+
path: 'run-name',
|
|
35
|
+
operation: 'preserve',
|
|
36
|
+
value: (() => {
|
|
37
|
+
const runNameScalar = new Scalar(`\${{ github.event_name == 'pull_request' && !contains('${branchList}', github.head_ref) && github.event.pull_request.title || github.ref_name }} #\${{ inputs.run_number || github.run_number }}\${{ inputs.version && format(' - {0}', inputs.version) || '' }}`);
|
|
38
|
+
runNameScalar.type = Scalar.QUOTE_DOUBLE;
|
|
39
|
+
return runNameScalar;
|
|
40
|
+
})(),
|
|
41
|
+
required: true,
|
|
42
|
+
spaceBefore: true
|
|
43
|
+
},
|
|
44
|
+
// =============================================================================
|
|
45
|
+
// WORKFLOW TRIGGERS
|
|
46
|
+
// =============================================================================
|
|
47
|
+
{
|
|
48
|
+
path: 'on',
|
|
49
|
+
operation: 'set',
|
|
50
|
+
value: {},
|
|
51
|
+
required: true,
|
|
52
|
+
spaceBefore: true
|
|
53
|
+
},
|
|
54
|
+
// workflow_dispatch inputs
|
|
55
|
+
{
|
|
56
|
+
path: 'on.workflow_dispatch.inputs.version',
|
|
57
|
+
operation: 'set',
|
|
58
|
+
value: {
|
|
59
|
+
description: 'The version to deploy',
|
|
60
|
+
required: false,
|
|
61
|
+
type: 'string'
|
|
62
|
+
},
|
|
63
|
+
required: true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
path: 'on.workflow_dispatch.inputs.baseRef',
|
|
67
|
+
operation: 'set',
|
|
68
|
+
value: {
|
|
69
|
+
description: 'The base reference for comparison',
|
|
70
|
+
required: false,
|
|
71
|
+
type: 'string'
|
|
72
|
+
},
|
|
73
|
+
required: true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
path: 'on.workflow_dispatch.inputs.run_number',
|
|
77
|
+
operation: 'set',
|
|
78
|
+
value: {
|
|
79
|
+
description: 'The original run number from develop branch',
|
|
80
|
+
required: false,
|
|
81
|
+
type: 'string'
|
|
82
|
+
},
|
|
83
|
+
required: true
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
path: 'on.workflow_dispatch.inputs.commitSha',
|
|
87
|
+
operation: 'set',
|
|
88
|
+
value: {
|
|
89
|
+
description: 'The exact commit SHA to checkout and test',
|
|
90
|
+
required: false,
|
|
91
|
+
type: 'string'
|
|
92
|
+
},
|
|
93
|
+
required: true
|
|
94
|
+
},
|
|
95
|
+
// workflow_call inputs (same as workflow_dispatch)
|
|
96
|
+
{
|
|
97
|
+
path: 'on.workflow_call.inputs.version',
|
|
98
|
+
operation: 'set',
|
|
99
|
+
value: {
|
|
100
|
+
description: 'The version to deploy',
|
|
101
|
+
required: false,
|
|
102
|
+
type: 'string'
|
|
103
|
+
},
|
|
104
|
+
required: true
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
path: 'on.workflow_call.inputs.baseRef',
|
|
108
|
+
operation: 'set',
|
|
109
|
+
value: {
|
|
110
|
+
description: 'The base reference for comparison',
|
|
111
|
+
required: false,
|
|
112
|
+
type: 'string'
|
|
113
|
+
},
|
|
114
|
+
required: true
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
path: 'on.workflow_call.inputs.run_number',
|
|
118
|
+
operation: 'set',
|
|
119
|
+
value: {
|
|
120
|
+
description: 'The original run number from develop branch',
|
|
121
|
+
required: false,
|
|
122
|
+
type: 'string'
|
|
123
|
+
},
|
|
124
|
+
required: true
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
path: 'on.workflow_call.inputs.commitSha',
|
|
128
|
+
operation: 'set',
|
|
129
|
+
value: {
|
|
130
|
+
description: 'The exact commit SHA to checkout and test',
|
|
131
|
+
required: false,
|
|
132
|
+
type: 'string'
|
|
133
|
+
},
|
|
134
|
+
required: true
|
|
135
|
+
},
|
|
136
|
+
// push trigger
|
|
137
|
+
{
|
|
138
|
+
path: 'on.push.branches',
|
|
139
|
+
operation: 'set',
|
|
140
|
+
value: validBranchFlow,
|
|
141
|
+
required: true
|
|
142
|
+
},
|
|
143
|
+
// pull_request trigger
|
|
144
|
+
{
|
|
145
|
+
path: 'on.pull_request.types',
|
|
146
|
+
operation: 'set',
|
|
147
|
+
value: ['opened', 'synchronize', 'reopened'],
|
|
148
|
+
required: true
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
path: 'on.pull_request.branches',
|
|
152
|
+
operation: 'set',
|
|
153
|
+
value: [validBranchFlow[0]], // Only target initial branch
|
|
154
|
+
required: true
|
|
155
|
+
}
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=operations-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations-header.js","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-header.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAM7B;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAkB;IACvD,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;IAC1B,qDAAqD;IACrD,MAAM,eAAe,GAAG,CAAC,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IAClH,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAE5C,OAAO;QACL,gFAAgF;QAChF,gBAAgB;QAChB,gFAAgF;QAChF;YACE,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,UAAU;YACrB,KAAK,EAAE,CAAC,GAAG,EAAE;gBACX,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,CAAA;gBACzC,UAAU,CAAC,IAAI,GAAG,MAAM,CAAC,YAAY,CAAA;gBACrC,OAAO,UAAU,CAAA;YACnB,CAAC,CAAC,EAAE;YACJ,QAAQ,EAAE,IAAI;SACf;QAED,gFAAgF;QAChF,4CAA4C;QAC5C,gFAAgF;QAChF;YACE,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,UAAU;YACrB,K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shared Tag, Promote, and Release Job Operations
|
|
3
|
+
*
|
|
4
|
+
* Generates the tag creation, branch promotion, and GitHub release jobs.
|
|
5
|
+
*/
|
|
6
|
+
import { PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
7
|
+
export interface TagPromoteContext {
|
|
8
|
+
branchFlow: string[];
|
|
9
|
+
deployJobNames: string[];
|
|
10
|
+
remoteTestJobNames: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create tag, promote, and release job operations
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTagPromoteReleaseOperations(ctx: TagPromoteContext): PathOperationConfig[];
|
|
16
|
+
//# sourceMappingURL=operations-tag-promote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations-tag-promote.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-tag-promote.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAyB,MAAM,uCAAuC,CAAA;AAElG,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,iBAAiB,GAAG,mBAAmB,EAAE,CA2F/F"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Tag, Promote, and Release Job Operations
|
|
3
|
+
*
|
|
4
|
+
* Generates the tag creation, branch promotion, and GitHub release jobs.
|
|
5
|
+
*/
|
|
6
|
+
import { createValueFromString } from '../../../utils/ast-path-operations.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create tag, promote, and release job operations
|
|
9
|
+
*/
|
|
10
|
+
export function createTagPromoteReleaseOperations(ctx) {
|
|
11
|
+
const { branchFlow, deployJobNames, remoteTestJobNames } = ctx;
|
|
12
|
+
// Provide sensible defaults if branchFlow is invalid
|
|
13
|
+
const validBranchFlow = (branchFlow && Array.isArray(branchFlow) && branchFlow.length > 0) ? branchFlow : ['main'];
|
|
14
|
+
const allDeploymentJobs = [...deployJobNames, ...remoteTestJobNames];
|
|
15
|
+
const initialBranch = validBranchFlow[0];
|
|
16
|
+
// Build tag job conditional (should only run on initial branch, not on PRs)
|
|
17
|
+
const tagConditions = [
|
|
18
|
+
'always()',
|
|
19
|
+
'github.event_name != \'pull_request\'',
|
|
20
|
+
`github.ref_name == '${initialBranch}'`,
|
|
21
|
+
'needs.version.result == \'success\'',
|
|
22
|
+
'needs.version.outputs.version != \'\''
|
|
23
|
+
];
|
|
24
|
+
if (allDeploymentJobs.length > 0) {
|
|
25
|
+
const noFailures = allDeploymentJobs.map(job => `needs.${job}.result != 'failure'`).join(' && ');
|
|
26
|
+
const atLeastOneSuccess = allDeploymentJobs.map(job => `needs.${job}.result == 'success'`).join(' || ');
|
|
27
|
+
tagConditions.push(`(${noFailures})`);
|
|
28
|
+
tagConditions.push(`(${atLeastOneSuccess})`);
|
|
29
|
+
}
|
|
30
|
+
const tagNeedsArray = ['version', ...allDeploymentJobs];
|
|
31
|
+
return [
|
|
32
|
+
// TAG JOB
|
|
33
|
+
{
|
|
34
|
+
path: 'jobs.tag',
|
|
35
|
+
operation: 'overwrite',
|
|
36
|
+
commentBefore: `
|
|
37
|
+
=============================================================================
|
|
38
|
+
TAG & PROMOTE (⚠️ Managed by Pipecraft - do not modify)
|
|
39
|
+
=============================================================================
|
|
40
|
+
Creates git tags and promotes code through branch flow.
|
|
41
|
+
`,
|
|
42
|
+
value: createValueFromString(`
|
|
43
|
+
if: \${{ ${tagConditions.join(' && ')} }}
|
|
44
|
+
needs: [ ${tagNeedsArray.join(', ')} ]
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v4
|
|
48
|
+
with:
|
|
49
|
+
ref: \${{ inputs.commitSha || github.sha }}
|
|
50
|
+
- uses: ./.github/actions/create-tag
|
|
51
|
+
with:
|
|
52
|
+
version: \${{ needs.version.outputs.version }}
|
|
53
|
+
commitSha: \${{ inputs.commitSha || github.sha }}
|
|
54
|
+
`)
|
|
55
|
+
},
|
|
56
|
+
// PROMOTE JOB
|
|
57
|
+
{
|
|
58
|
+
path: 'jobs.promote',
|
|
59
|
+
operation: 'overwrite',
|
|
60
|
+
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
|
+
needs: [ version, tag ]
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v4
|
|
66
|
+
with:
|
|
67
|
+
ref: \${{ inputs.commitSha || github.sha }}
|
|
68
|
+
- uses: ./.github/actions/promote-branch
|
|
69
|
+
with:
|
|
70
|
+
version: \${{ needs.version.outputs.version }}
|
|
71
|
+
currentBranch: \${{ github.ref_name }}
|
|
72
|
+
nextBranch: \${{ ${buildNextBranchExpression(validBranchFlow)} }}
|
|
73
|
+
runNumber: \${{ github.run_number }}
|
|
74
|
+
`)
|
|
75
|
+
},
|
|
76
|
+
// RELEASE JOB
|
|
77
|
+
{
|
|
78
|
+
path: 'jobs.release',
|
|
79
|
+
operation: 'overwrite',
|
|
80
|
+
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
|
+
needs: [ tag, version ]
|
|
83
|
+
runs-on: ubuntu-latest
|
|
84
|
+
steps:
|
|
85
|
+
- uses: actions/checkout@v4
|
|
86
|
+
with:
|
|
87
|
+
ref: \${{ inputs.commitSha || github.sha }}
|
|
88
|
+
- uses: ./.github/actions/create-release
|
|
89
|
+
with:
|
|
90
|
+
version: \${{ needs.version.outputs.version }}
|
|
91
|
+
commitSha: \${{ inputs.commitSha || github.sha }}
|
|
92
|
+
`)
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Helper to build promotable branches condition
|
|
98
|
+
* Returns a condition that checks if current branch is promotable (all except final branch)
|
|
99
|
+
*/
|
|
100
|
+
function buildPromotableBranchesCondition(branchFlow) {
|
|
101
|
+
const promotableBranches = branchFlow.slice(0, -1); // All branches except the last one
|
|
102
|
+
return promotableBranches.map(branch => `github.ref_name == '${branch}'`).join(' || ');
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Helper to build the nextBranch expression
|
|
106
|
+
*/
|
|
107
|
+
function buildNextBranchExpression(branchFlow) {
|
|
108
|
+
if (branchFlow.length === 1)
|
|
109
|
+
return `''`;
|
|
110
|
+
if (branchFlow.length === 2)
|
|
111
|
+
return `'${branchFlow[1]}'`;
|
|
112
|
+
// For 3+ branches: develop → staging, staging → main
|
|
113
|
+
return `github.ref_name == '${branchFlow[0]}' && '${branchFlow[1]}' || '${branchFlow[branchFlow.length - 1]}'`;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=operations-tag-promote.js.map
|
|
@@ -0,0 +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,EAAuB,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAQlG;;GAEG;AACH,MAAM,UAAU,iCAAiC,CAAC,GAAsB;IACtE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,GAAG,CAAA;IAC9D,qDAAqD;IACrD,MAAM,eAAe,GAAG,CAAC,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAA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CAAC;yPACsN,gCAAgC,CAAC,eAAe,CAAC;;;;;;;;;;;6BAW7Q,yBAAyB,CAAC,eAAe,CAAC;;GAEpE,CAAC;SACC;QAED,cAAc;QACd;YACE,IAAI,EAAE,cAAc;YACpB,SAAS,EAAE,WAAW;YACtB,KAAK,EAAE,qBAAqB,CAAC;+CACY,eAAe,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;;;;;;;;;;;GAWvF,CAAC;SACC;KACF,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,gCAAgC,CAAC,UAAoB;IAC5D,MAAM,kBAAkB,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA,CAAC,mCAAmC;IACtF,OAAO,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,uBAAuB,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACxF,CAAC;AAED;;GAEG;AACH,SAAS,yBAAyB,CAAC,UAAoB;IACrD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACxC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,CAAA;IAExD,qDAAqD;IACrD,OAAO,uBAAuB,UAAU,CAAC,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,SAAS,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAA;AAChH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Version Job Operation
|
|
3
|
+
*
|
|
4
|
+
* Generates the version calculation job that determines the next semantic version.
|
|
5
|
+
*/
|
|
6
|
+
import { PathOperationConfig } from '../../../utils/ast-path-operations.js';
|
|
7
|
+
export interface VersionContext {
|
|
8
|
+
testJobNames: string[];
|
|
9
|
+
nxEnabled?: boolean;
|
|
10
|
+
baseRef?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create the version calculation job operation
|
|
14
|
+
*/
|
|
15
|
+
export declare function createVersionJobOperation(ctx: VersionContext): PathOperationConfig;
|
|
16
|
+
//# sourceMappingURL=operations-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations-version.d.ts","sourceRoot":"","sources":["../../../../src/templates/workflows/shared/operations-version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAyB,MAAM,uCAAuC,CAAA;AAElG,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,cAAc,GAAG,mBAAmB,CAkDlF"}
|