pipecraft 0.28.1 → 0.28.3
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 +63 -12
- 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 +10 -3
- package/dist/generators/workflows.tpl.js.map +1 -1
- 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 +179 -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 +42 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/generators/init.tpl.ts +71 -15
- package/src/generators/workflows.tpl.ts +9 -3
- 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,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path-Based Pipeline Template
|
|
3
|
+
*
|
|
4
|
+
* Generates a workflow that uses path-based change detection to identify which domains
|
|
5
|
+
* have changed and runs appropriate test/deploy jobs.
|
|
6
|
+
*
|
|
7
|
+
* Uses shared operations architecture for maintainability and consistency with Nx template.
|
|
8
|
+
*/
|
|
9
|
+
import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
10
|
+
import { parseDocument, stringify } from 'yaml';
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import { logger } from '../../utils/logger.js';
|
|
13
|
+
import { applyPathOperations } from '../../utils/ast-path-operations.js';
|
|
14
|
+
import { formatIfConditions } from '../yaml-format-utils.js';
|
|
15
|
+
import { createHeaderOperations, createChangesJobOperation, createDomainTestJobOperations, createDomainDeployJobOperations, createDomainRemoteTestJobOperations, createVersionJobOperation, createTagPromoteReleaseOperations, getDomainJobNames } from './shared/index.js';
|
|
16
|
+
/**
|
|
17
|
+
* Main generator that handles merging with existing workflow
|
|
18
|
+
*/
|
|
19
|
+
export const generate = (ctx) => Promise.resolve(ctx)
|
|
20
|
+
.then(ctx => {
|
|
21
|
+
const filePath = `${ctx.cwd || process.cwd()}/.github/workflows/pipeline.yml`;
|
|
22
|
+
const { config, branchFlow } = ctx;
|
|
23
|
+
const domains = config?.domains || {};
|
|
24
|
+
// Get domain job names for dependency management
|
|
25
|
+
const { testJobs, deployJobs, remoteTestJobs } = getDomainJobNames(domains);
|
|
26
|
+
// Build operations array
|
|
27
|
+
const operations = [
|
|
28
|
+
// Header (name, run-name, on triggers)
|
|
29
|
+
...createHeaderOperations({ branchFlow }),
|
|
30
|
+
// Changes detection (path-based)
|
|
31
|
+
createChangesJobOperation({
|
|
32
|
+
domains,
|
|
33
|
+
useNx: false,
|
|
34
|
+
baseRef: 'main'
|
|
35
|
+
}),
|
|
36
|
+
// NO nx-ci job for path-based (that's the key difference!)
|
|
37
|
+
// Domain test jobs (preserved for user customization)
|
|
38
|
+
...createDomainTestJobOperations({ domains }),
|
|
39
|
+
// Version calculation
|
|
40
|
+
createVersionJobOperation({
|
|
41
|
+
testJobNames: testJobs,
|
|
42
|
+
nxEnabled: false,
|
|
43
|
+
baseRef: 'main'
|
|
44
|
+
}),
|
|
45
|
+
// Domain deploy jobs (preserved for user customization)
|
|
46
|
+
...createDomainDeployJobOperations({ domains }),
|
|
47
|
+
// Domain remote test jobs (preserved for user customization)
|
|
48
|
+
...createDomainRemoteTestJobOperations({ domains }),
|
|
49
|
+
// Tag, promote, release
|
|
50
|
+
...createTagPromoteReleaseOperations({
|
|
51
|
+
branchFlow,
|
|
52
|
+
deployJobNames: deployJobs,
|
|
53
|
+
remoteTestJobNames: remoteTestJobs
|
|
54
|
+
})
|
|
55
|
+
];
|
|
56
|
+
// Check if file exists
|
|
57
|
+
if (!fs.existsSync(filePath)) {
|
|
58
|
+
logger.verbose('📝 Creating new path-based pipeline');
|
|
59
|
+
// Create new document with empty YAML map
|
|
60
|
+
const doc = parseDocument('{}');
|
|
61
|
+
if (doc.contents) {
|
|
62
|
+
applyPathOperations(doc.contents, operations, doc);
|
|
63
|
+
}
|
|
64
|
+
const yamlContent = stringify(doc, { lineWidth: 0, minContentWidth: 0 });
|
|
65
|
+
const formattedContent = formatIfConditions(yamlContent);
|
|
66
|
+
return { ...ctx, yamlContent: formattedContent, mergeStatus: 'created' };
|
|
67
|
+
}
|
|
68
|
+
// Parse existing file
|
|
69
|
+
const existingContent = fs.readFileSync(filePath, 'utf8');
|
|
70
|
+
const doc = parseDocument(existingContent);
|
|
71
|
+
// Get managed jobs (always overwritten)
|
|
72
|
+
const managedJobs = new Set(['changes', 'version', 'tag', 'promote', 'release']);
|
|
73
|
+
// Get deprecated jobs (should be removed)
|
|
74
|
+
const deprecatedJobs = new Set(['createpr', 'branch']);
|
|
75
|
+
// Extract user jobs from existing (preserves comments!)
|
|
76
|
+
const userJobs = new Map();
|
|
77
|
+
const existingJobs = doc.contents && doc.contents.get ? doc.contents.get('jobs') : null;
|
|
78
|
+
if (existingJobs && existingJobs.items) {
|
|
79
|
+
for (const item of existingJobs.items) {
|
|
80
|
+
const jobName = item.key?.toString();
|
|
81
|
+
if (jobName &&
|
|
82
|
+
!managedJobs.has(jobName) &&
|
|
83
|
+
!deprecatedJobs.has(jobName) &&
|
|
84
|
+
!testJobs.includes(jobName) &&
|
|
85
|
+
!deployJobs.includes(jobName) &&
|
|
86
|
+
!remoteTestJobs.includes(jobName)) {
|
|
87
|
+
// This is a custom user job - preserve it completely
|
|
88
|
+
userJobs.set(jobName, item);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Clear all jobs before applying operations to prevent duplicates
|
|
93
|
+
if (existingJobs && existingJobs.items) {
|
|
94
|
+
;
|
|
95
|
+
existingJobs.items = [];
|
|
96
|
+
}
|
|
97
|
+
// Apply operations to update managed jobs
|
|
98
|
+
if (doc.contents) {
|
|
99
|
+
applyPathOperations(doc.contents, operations, doc);
|
|
100
|
+
}
|
|
101
|
+
// Add back user jobs (preserves their comments!)
|
|
102
|
+
if (userJobs.size > 0) {
|
|
103
|
+
logger.verbose(`📋 Preserving ${userJobs.size} user jobs: ${Array.from(userJobs.keys()).join(', ')}`);
|
|
104
|
+
const jobsNode = doc.contents.get('jobs');
|
|
105
|
+
if (jobsNode && jobsNode.items) {
|
|
106
|
+
for (const [_, item] of userJobs) {
|
|
107
|
+
jobsNode.items.push(item);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Check for deprecated jobs
|
|
112
|
+
const deprecatedFound = [];
|
|
113
|
+
if (existingJobs && existingJobs.items) {
|
|
114
|
+
for (const item of existingJobs.items) {
|
|
115
|
+
const jobName = item.key?.toString();
|
|
116
|
+
if (jobName && deprecatedJobs.has(jobName)) {
|
|
117
|
+
deprecatedFound.push(jobName);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (deprecatedFound.length > 0) {
|
|
122
|
+
logger.verbose(`🗑️ Removed deprecated jobs: ${deprecatedFound.join(', ')}`);
|
|
123
|
+
}
|
|
124
|
+
const status = userJobs.size > 0 ? 'merged' : 'updated';
|
|
125
|
+
const yamlContent = stringify(doc, { lineWidth: 0, minContentWidth: 0 });
|
|
126
|
+
const formattedContent = formatIfConditions(yamlContent);
|
|
127
|
+
return { ...ctx, yamlContent: formattedContent, mergeStatus: status };
|
|
128
|
+
})
|
|
129
|
+
.then(ctx => {
|
|
130
|
+
const outputPath = ctx.outputPipelinePath || '.github/workflows/pipeline.yml';
|
|
131
|
+
const status = ctx.mergeStatus === 'merged' ? '🔄 Merged with existing' : ctx.mergeStatus === 'updated' ? '🔄 Updated existing' : '📝 Created new';
|
|
132
|
+
logger.verbose(`${status} ${outputPath}`);
|
|
133
|
+
return ctx;
|
|
134
|
+
})
|
|
135
|
+
.then(renderTemplate((ctx) => ctx.yamlContent, toFile((ctx) => ctx.outputPipelinePath || '.github/workflows/pipeline.yml')));
|
|
136
|
+
//# sourceMappingURL=pipeline.yml.tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/workflows/pipeline.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAiB,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE7E,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAC/C,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAuB,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,6BAA6B,EAC7B,+BAA+B,EAC/B,mCAAmC,EACnC,yBAAyB,EACzB,iCAAiC,EACjC,iBAAiB,EAClB,MAAM,mBAAmB,CAAA;AAS1B;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA6B,EAAE,EAAE,CACxD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;KACjB,IAAI,CAAC,GAAG,CAAC,EAAE;IACV,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,C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KACD,IAAI,CAAC,cAAc,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,kBAAkB,IAAI,gCAAgC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -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.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","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,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,CAAC,GAAsB;IAClE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAA;IACvB,MAAM,UAAU,GAA0B,EAAE,CAAA;IAE5C,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAA;IAE9F,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACxC,UAAU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AI,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":"A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AAI,EAAE,oCAAoC;YAC1C,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE;gBACL,WAAW,EAAE,6CAA6C;gBAC1D,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,QAAQ;aACf;YACD,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,mCAAmC;YACzC,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE;gBACL,WAAW,EAAE,2CAA2C;gBACxD,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,QAAQ;aACf;YACD,QAAQ,EAAE,IAAI;SACf;QAED,eAAe;QACf;YACE,IAAI,EAAE,kBAAkB;YACxB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,eAAe;YACtB,QAAQ,EAAE,IAAI;SACf;QAED,uBAAuB;QACvB;YACE,IAAI,EAAE,uBAAuB;YAC7B,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,UAAU,CAAC;YAC5C,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,0BAA0B;YAChC,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,6BAA6B;YAC1D,QAAQ,EAAE,IAAI;SACf;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 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"}
|