@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.mjs
CHANGED
|
@@ -35287,6 +35287,22 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component21 {
|
|
|
35287
35287
|
}
|
|
35288
35288
|
];
|
|
35289
35289
|
};
|
|
35290
|
+
/**
|
|
35291
|
+
* Build the deterministic GitHub Actions job name for a deploy target.
|
|
35292
|
+
*
|
|
35293
|
+
* Used both to register the post-build job and as the sticky-PR-comment
|
|
35294
|
+
* header so dev/stage/prod comments don't collide on the same PR.
|
|
35295
|
+
*/
|
|
35296
|
+
this.buildJobName = (target) => {
|
|
35297
|
+
return [
|
|
35298
|
+
target.awsStageType,
|
|
35299
|
+
target.deploymentTargetRole,
|
|
35300
|
+
"deploy",
|
|
35301
|
+
target.project.name,
|
|
35302
|
+
target.account,
|
|
35303
|
+
target.region
|
|
35304
|
+
].join("-");
|
|
35305
|
+
};
|
|
35290
35306
|
/**
|
|
35291
35307
|
* Builds a GitHub Actions condition string that checks if the current branch
|
|
35292
35308
|
* matches any of the provided branch patterns.
|
|
@@ -35326,6 +35342,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component21 {
|
|
|
35326
35342
|
} = target;
|
|
35327
35343
|
const { roleArn, stackPattern } = ciDeploymentConfig ?? {};
|
|
35328
35344
|
const { rootCdkOut } = awsDeploymentConfig;
|
|
35345
|
+
const deployJobName = this.buildJobName(target);
|
|
35329
35346
|
return [
|
|
35330
35347
|
...this.setupPnpm(),
|
|
35331
35348
|
...this.setupNode(),
|
|
@@ -35358,7 +35375,39 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component21 {
|
|
|
35358
35375
|
...awsDeploymentConfig.cdkCli.deployOptionsFor(target),
|
|
35359
35376
|
app: rootCdkOut,
|
|
35360
35377
|
stackPatterns: stackPattern ? [stackPattern] : void 0
|
|
35361
|
-
})}`
|
|
35378
|
+
})} --outputs-file cdk-outputs.json`
|
|
35379
|
+
},
|
|
35380
|
+
/**
|
|
35381
|
+
* Render a job-summary table listing every `*Endpoint` output emitted
|
|
35382
|
+
* by the deploy. Also writes the same list to `deploy-urls.md` so the
|
|
35383
|
+
* follow-up sticky-PR-comment step can reuse it.
|
|
35384
|
+
*/
|
|
35385
|
+
{
|
|
35386
|
+
name: "Render deploy summary",
|
|
35387
|
+
if: "hashFiles('cdk-outputs.json') != ''",
|
|
35388
|
+
shell: "bash",
|
|
35389
|
+
run: [
|
|
35390
|
+
'# Convention: CfnOutputs whose logical ID ends in "Endpoint" are surfaced.',
|
|
35391
|
+
"# See docs/packages/@codedrifters/configulator/workflows/aws-deploy-workflow#surfacing-deploy-urls",
|
|
35392
|
+
'echo "## Deployed endpoints" >> "$GITHUB_STEP_SUMMARY"',
|
|
35393
|
+
`jq -r '[.[] | to_entries[] | select(.key | test("Endpoint$")) | .value] | .[] | "- [\\(.)](\\(.))"' cdk-outputs.json | tee deploy-urls.md >> "$GITHUB_STEP_SUMMARY"`,
|
|
35394
|
+
'echo "" >> "$GITHUB_STEP_SUMMARY"',
|
|
35395
|
+
'echo "_DNS/CloudFront may take ~1 minute to propagate._" >> "$GITHUB_STEP_SUMMARY"'
|
|
35396
|
+
].join("\n")
|
|
35397
|
+
},
|
|
35398
|
+
/**
|
|
35399
|
+
* Post a sticky PR comment listing each deployed endpoint. The
|
|
35400
|
+
* comment is keyed by the deploy job name so dev/stage/prod comments
|
|
35401
|
+
* don't collide on the same PR.
|
|
35402
|
+
*/
|
|
35403
|
+
{
|
|
35404
|
+
name: "Sticky PR comment with deploy endpoints",
|
|
35405
|
+
if: "github.event_name == 'pull_request' && hashFiles('deploy-urls.md') != ''",
|
|
35406
|
+
uses: "marocchino/sticky-pull-request-comment@v2",
|
|
35407
|
+
with: {
|
|
35408
|
+
header: deployJobName,
|
|
35409
|
+
path: "deploy-urls.md"
|
|
35410
|
+
}
|
|
35362
35411
|
}
|
|
35363
35412
|
];
|
|
35364
35413
|
};
|
|
@@ -35453,18 +35502,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component21 {
|
|
|
35453
35502
|
...buildWorkflowOptions?.preBuildSteps ?? []
|
|
35454
35503
|
]
|
|
35455
35504
|
});
|
|
35456
|
-
const buildJobName = (target) => {
|
|
35457
|
-
return [
|
|
35458
|
-
target.awsStageType,
|
|
35459
|
-
target.deploymentTargetRole,
|
|
35460
|
-
"deploy",
|
|
35461
|
-
target.project.name,
|
|
35462
|
-
target.account,
|
|
35463
|
-
target.region
|
|
35464
|
-
].join("-");
|
|
35465
|
-
};
|
|
35466
35505
|
this.awsDeploymentTargets.forEach((target) => {
|
|
35467
|
-
const deployJobName = buildJobName(target);
|
|
35506
|
+
const deployJobName = this.buildJobName(target);
|
|
35468
35507
|
const branchFilterCondition = this.buildBranchFilterCondition(
|
|
35469
35508
|
target.branches
|
|
35470
35509
|
);
|
|
@@ -35477,13 +35516,14 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component21 {
|
|
|
35477
35516
|
needs: [
|
|
35478
35517
|
"build",
|
|
35479
35518
|
...this.deployAfterTargets.map((p) => {
|
|
35480
|
-
return buildJobName(p);
|
|
35519
|
+
return this.buildJobName(p);
|
|
35481
35520
|
})
|
|
35482
35521
|
],
|
|
35483
35522
|
runsOn: ["ubuntu-latest"],
|
|
35484
35523
|
permissions: {
|
|
35485
35524
|
contents: JobPermission5.READ,
|
|
35486
|
-
idToken: JobPermission5.WRITE
|
|
35525
|
+
idToken: JobPermission5.WRITE,
|
|
35526
|
+
pullRequests: JobPermission5.WRITE
|
|
35487
35527
|
},
|
|
35488
35528
|
concurrency: deployJobName,
|
|
35489
35529
|
if: jobCondition,
|