@codedrifters/configulator 0.0.323 → 0.0.325
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/lib/index.d.mts +17 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +54 -14
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +54 -14
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.mts
CHANGED
|
@@ -11044,6 +11044,16 @@ interface DeployWorkflowOptions {
|
|
|
11044
11044
|
*/
|
|
11045
11045
|
readonly deployAfterTargets?: Array<AwsDeploymentTarget>;
|
|
11046
11046
|
}
|
|
11047
|
+
/**
|
|
11048
|
+
* Adds a build + deploy GitHub Actions workflow for an AwsCdkTypeScriptApp.
|
|
11049
|
+
*
|
|
11050
|
+
* Deploy URLs are surfaced via a naming convention: any CfnOutput whose
|
|
11051
|
+
* logical ID ends in `Endpoint` is rendered into the PR sticky comment and
|
|
11052
|
+
* the job summary. See the docs page for the full convention and naming
|
|
11053
|
+
* guidance.
|
|
11054
|
+
*
|
|
11055
|
+
* @see docs/packages/@codedrifters/configulator/workflows/aws-deploy-workflow.md
|
|
11056
|
+
*/
|
|
11047
11057
|
declare class AwsDeployWorkflow extends Component {
|
|
11048
11058
|
project: AwsCdkTypeScriptApp;
|
|
11049
11059
|
options: DeployWorkflowOptions;
|
|
@@ -11082,6 +11092,13 @@ declare class AwsDeployWorkflow extends Component {
|
|
|
11082
11092
|
constructor(project: AwsCdkTypeScriptApp, options?: DeployWorkflowOptions);
|
|
11083
11093
|
setupNode: () => Array<JobStep>;
|
|
11084
11094
|
setupPnpm: () => Array<JobStep>;
|
|
11095
|
+
/**
|
|
11096
|
+
* Build the deterministic GitHub Actions job name for a deploy target.
|
|
11097
|
+
*
|
|
11098
|
+
* Used both to register the post-build job and as the sticky-PR-comment
|
|
11099
|
+
* header so dev/stage/prod comments don't collide on the same PR.
|
|
11100
|
+
*/
|
|
11101
|
+
private buildJobName;
|
|
11085
11102
|
/**
|
|
11086
11103
|
* Builds a GitHub Actions condition string that checks if the current branch
|
|
11087
11104
|
* matches any of the provided branch patterns.
|
package/lib/index.d.ts
CHANGED
|
@@ -11093,6 +11093,16 @@ interface DeployWorkflowOptions {
|
|
|
11093
11093
|
*/
|
|
11094
11094
|
readonly deployAfterTargets?: Array<AwsDeploymentTarget>;
|
|
11095
11095
|
}
|
|
11096
|
+
/**
|
|
11097
|
+
* Adds a build + deploy GitHub Actions workflow for an AwsCdkTypeScriptApp.
|
|
11098
|
+
*
|
|
11099
|
+
* Deploy URLs are surfaced via a naming convention: any CfnOutput whose
|
|
11100
|
+
* logical ID ends in `Endpoint` is rendered into the PR sticky comment and
|
|
11101
|
+
* the job summary. See the docs page for the full convention and naming
|
|
11102
|
+
* guidance.
|
|
11103
|
+
*
|
|
11104
|
+
* @see docs/packages/@codedrifters/configulator/workflows/aws-deploy-workflow.md
|
|
11105
|
+
*/
|
|
11096
11106
|
declare class AwsDeployWorkflow extends Component {
|
|
11097
11107
|
project: AwsCdkTypeScriptApp;
|
|
11098
11108
|
options: DeployWorkflowOptions;
|
|
@@ -11131,6 +11141,13 @@ declare class AwsDeployWorkflow extends Component {
|
|
|
11131
11141
|
constructor(project: AwsCdkTypeScriptApp, options?: DeployWorkflowOptions);
|
|
11132
11142
|
setupNode: () => Array<JobStep>;
|
|
11133
11143
|
setupPnpm: () => Array<JobStep>;
|
|
11144
|
+
/**
|
|
11145
|
+
* Build the deterministic GitHub Actions job name for a deploy target.
|
|
11146
|
+
*
|
|
11147
|
+
* Used both to register the post-build job and as the sticky-PR-comment
|
|
11148
|
+
* header so dev/stage/prod comments don't collide on the same PR.
|
|
11149
|
+
*/
|
|
11150
|
+
private buildJobName;
|
|
11134
11151
|
/**
|
|
11135
11152
|
* Builds a GitHub Actions condition string that checks if the current branch
|
|
11136
11153
|
* matches any of the provided branch patterns.
|
package/lib/index.js
CHANGED
|
@@ -35607,6 +35607,22 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen25.Compone
|
|
|
35607
35607
|
}
|
|
35608
35608
|
];
|
|
35609
35609
|
};
|
|
35610
|
+
/**
|
|
35611
|
+
* Build the deterministic GitHub Actions job name for a deploy target.
|
|
35612
|
+
*
|
|
35613
|
+
* Used both to register the post-build job and as the sticky-PR-comment
|
|
35614
|
+
* header so dev/stage/prod comments don't collide on the same PR.
|
|
35615
|
+
*/
|
|
35616
|
+
this.buildJobName = (target) => {
|
|
35617
|
+
return [
|
|
35618
|
+
target.awsStageType,
|
|
35619
|
+
target.deploymentTargetRole,
|
|
35620
|
+
"deploy",
|
|
35621
|
+
target.project.name,
|
|
35622
|
+
target.account,
|
|
35623
|
+
target.region
|
|
35624
|
+
].join("-");
|
|
35625
|
+
};
|
|
35610
35626
|
/**
|
|
35611
35627
|
* Builds a GitHub Actions condition string that checks if the current branch
|
|
35612
35628
|
* matches any of the provided branch patterns.
|
|
@@ -35646,6 +35662,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen25.Compone
|
|
|
35646
35662
|
} = target;
|
|
35647
35663
|
const { roleArn, stackPattern } = ciDeploymentConfig ?? {};
|
|
35648
35664
|
const { rootCdkOut } = awsDeploymentConfig;
|
|
35665
|
+
const deployJobName = this.buildJobName(target);
|
|
35649
35666
|
return [
|
|
35650
35667
|
...this.setupPnpm(),
|
|
35651
35668
|
...this.setupNode(),
|
|
@@ -35678,7 +35695,39 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen25.Compone
|
|
|
35678
35695
|
...awsDeploymentConfig.cdkCli.deployOptionsFor(target),
|
|
35679
35696
|
app: rootCdkOut,
|
|
35680
35697
|
stackPatterns: stackPattern ? [stackPattern] : void 0
|
|
35681
|
-
})}`
|
|
35698
|
+
})} --outputs-file cdk-outputs.json`
|
|
35699
|
+
},
|
|
35700
|
+
/**
|
|
35701
|
+
* Render a job-summary table listing every `*Endpoint` output emitted
|
|
35702
|
+
* by the deploy. Also writes the same list to `deploy-urls.md` so the
|
|
35703
|
+
* follow-up sticky-PR-comment step can reuse it.
|
|
35704
|
+
*/
|
|
35705
|
+
{
|
|
35706
|
+
name: "Render deploy summary",
|
|
35707
|
+
if: "hashFiles('cdk-outputs.json') != ''",
|
|
35708
|
+
shell: "bash",
|
|
35709
|
+
run: [
|
|
35710
|
+
'# Convention: CfnOutputs whose logical ID ends in "Endpoint" are surfaced.',
|
|
35711
|
+
"# See docs/packages/@codedrifters/configulator/workflows/aws-deploy-workflow#surfacing-deploy-urls",
|
|
35712
|
+
'echo "## Deployed endpoints" >> "$GITHUB_STEP_SUMMARY"',
|
|
35713
|
+
`jq -r '[.[] | to_entries[] | select(.key | test("Endpoint$")) | .value] | .[] | "- [\\(.)](\\(.))"' cdk-outputs.json | tee deploy-urls.md >> "$GITHUB_STEP_SUMMARY"`,
|
|
35714
|
+
'echo "" >> "$GITHUB_STEP_SUMMARY"',
|
|
35715
|
+
'echo "_DNS/CloudFront may take ~1 minute to propagate._" >> "$GITHUB_STEP_SUMMARY"'
|
|
35716
|
+
].join("\n")
|
|
35717
|
+
},
|
|
35718
|
+
/**
|
|
35719
|
+
* Post a sticky PR comment listing each deployed endpoint. The
|
|
35720
|
+
* comment is keyed by the deploy job name so dev/stage/prod comments
|
|
35721
|
+
* don't collide on the same PR.
|
|
35722
|
+
*/
|
|
35723
|
+
{
|
|
35724
|
+
name: "Sticky PR comment with deploy endpoints",
|
|
35725
|
+
if: "github.event_name == 'pull_request' && hashFiles('deploy-urls.md') != ''",
|
|
35726
|
+
uses: "marocchino/sticky-pull-request-comment@v2",
|
|
35727
|
+
with: {
|
|
35728
|
+
header: deployJobName,
|
|
35729
|
+
path: "deploy-urls.md"
|
|
35730
|
+
}
|
|
35682
35731
|
}
|
|
35683
35732
|
];
|
|
35684
35733
|
};
|
|
@@ -35773,18 +35822,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen25.Compone
|
|
|
35773
35822
|
...buildWorkflowOptions?.preBuildSteps ?? []
|
|
35774
35823
|
]
|
|
35775
35824
|
});
|
|
35776
|
-
const buildJobName = (target) => {
|
|
35777
|
-
return [
|
|
35778
|
-
target.awsStageType,
|
|
35779
|
-
target.deploymentTargetRole,
|
|
35780
|
-
"deploy",
|
|
35781
|
-
target.project.name,
|
|
35782
|
-
target.account,
|
|
35783
|
-
target.region
|
|
35784
|
-
].join("-");
|
|
35785
|
-
};
|
|
35786
35825
|
this.awsDeploymentTargets.forEach((target) => {
|
|
35787
|
-
const deployJobName = buildJobName(target);
|
|
35826
|
+
const deployJobName = this.buildJobName(target);
|
|
35788
35827
|
const branchFilterCondition = this.buildBranchFilterCondition(
|
|
35789
35828
|
target.branches
|
|
35790
35829
|
);
|
|
@@ -35797,13 +35836,14 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen25.Compone
|
|
|
35797
35836
|
needs: [
|
|
35798
35837
|
"build",
|
|
35799
35838
|
...this.deployAfterTargets.map((p) => {
|
|
35800
|
-
return buildJobName(p);
|
|
35839
|
+
return this.buildJobName(p);
|
|
35801
35840
|
})
|
|
35802
35841
|
],
|
|
35803
35842
|
runsOn: ["ubuntu-latest"],
|
|
35804
35843
|
permissions: {
|
|
35805
35844
|
contents: import_workflows_model5.JobPermission.READ,
|
|
35806
|
-
idToken: import_workflows_model5.JobPermission.WRITE
|
|
35845
|
+
idToken: import_workflows_model5.JobPermission.WRITE,
|
|
35846
|
+
pullRequests: import_workflows_model5.JobPermission.WRITE
|
|
35807
35847
|
},
|
|
35808
35848
|
concurrency: deployJobName,
|
|
35809
35849
|
if: jobCondition,
|