@codedrifters/configulator 0.0.424 → 0.0.425

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.mjs CHANGED
@@ -41932,6 +41932,33 @@ import { BuildWorkflow } from "projen/lib/build";
41932
41932
  import { GitHub as GitHub5, WorkflowSteps as WorkflowSteps2 } from "projen/lib/github";
41933
41933
  import { JobPermission as JobPermission5 } from "projen/lib/github/workflows-model";
41934
41934
 
41935
+ // src/workflows/deploy-gate.ts
41936
+ var DEPLOY_GATE = {
41937
+ /**
41938
+ * Hold each deploy job behind a GitHub environment so its protection rules —
41939
+ * required reviewers, wait timers, deployment branch policies — apply before
41940
+ * the job is sent to a runner.
41941
+ */
41942
+ ENVIRONMENT: "environment"
41943
+ };
41944
+ var resolveEnvironmentGate = (gate, environmentName, componentName) => {
41945
+ const trimmed = environmentName?.trim();
41946
+ if (gate === void 0) {
41947
+ if (trimmed) {
41948
+ throw new Error(
41949
+ `${componentName} requires \`gate\` to be set when \`environmentName\` is supplied, got "${environmentName}" with no gate`
41950
+ );
41951
+ }
41952
+ return void 0;
41953
+ }
41954
+ if (!trimmed) {
41955
+ throw new Error(
41956
+ `${componentName} requires a non-empty \`environmentName\` when \`gate\` is "${gate}"`
41957
+ );
41958
+ }
41959
+ return trimmed;
41960
+ };
41961
+
41935
41962
  // src/workflows/home-repository.ts
41936
41963
  var HOME_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
41937
41964
  var renderHomeRepositoryCondition = (homeRepository, componentName) => {
@@ -42299,6 +42326,11 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42299
42326
  artifact: options.diff?.artifact ?? true,
42300
42327
  summary: options.diff?.summary ?? true
42301
42328
  };
42329
+ this.environmentName = resolveEnvironmentGate(
42330
+ options.gate,
42331
+ options.environmentName,
42332
+ "AwsDeployWorkflow"
42333
+ );
42302
42334
  this.homeRepository = options.homeRepository;
42303
42335
  const homeRepositoryCondition = renderHomeRepositoryCondition(
42304
42336
  this.homeRepository,
@@ -42386,10 +42418,12 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42386
42418
  ...homeRepositoryCondition ? [homeRepositoryCondition] : [],
42387
42419
  ...branchFilterCondition ? [`(${branchFilterCondition})`] : []
42388
42420
  ].join(" && ") + " }}";
42421
+ const gatedOnDiff = !!this.environmentName && this.diffOptions.enabled;
42389
42422
  this.buildWorkflow.addPostBuildJob(deployJobName, {
42390
42423
  name: `Deploy ${this.project.name} ${target.awsStageType}/${target.deploymentTargetRole}/${target.account}/${target.region}`,
42391
42424
  needs: [
42392
42425
  "build",
42426
+ ...gatedOnDiff ? [this.buildDiffJobName(target)] : [],
42393
42427
  ...this.deployAfterTargets.map((p) => {
42394
42428
  return this.buildJobName(p);
42395
42429
  })
@@ -42400,6 +42434,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42400
42434
  idToken: JobPermission5.WRITE,
42401
42435
  pullRequests: JobPermission5.WRITE
42402
42436
  },
42437
+ ...this.environmentName ? { environment: this.environmentName } : void 0,
42403
42438
  concurrency: deployJobName,
42404
42439
  if: jobCondition,
42405
42440
  steps: [...this.deploySteps(target)]
@@ -43394,6 +43429,7 @@ export {
43394
43429
  DEFAULT_UNBLOCK_COMMENT_TEMPLATE,
43395
43430
  DEFAULT_UNBLOCK_DEPENDENTS_ENABLED,
43396
43431
  DEFAULT_UPSTREAM_CONFIGULATOR_ENABLED,
43432
+ DEPLOY_GATE,
43397
43433
  DOCS_SYNC_AUDIT_SCHEMA_VERSION,
43398
43434
  GITHUB_ISSUE_TYPES,
43399
43435
  GITHUB_ISSUE_TYPE_BY_TITLE_PREFIX,
@@ -43624,6 +43660,7 @@ export {
43624
43660
  resolveBuildPolicy,
43625
43661
  resolveBundleAgentTiers,
43626
43662
  resolveDefaultAgentTier,
43663
+ resolveEnvironmentGate,
43627
43664
  resolveIssueDefaults,
43628
43665
  resolveIssueTemplates,
43629
43666
  resolveModelAlias,