constructor()

in lib/publishing.ts [228:273]


  constructor(parent: Construct, id: string, props: PublishToNuGetProjectProps) {
    super(parent, id);

    const environment: { [key: string]: string } = { };

    environment.FOR_REAL = props.dryRun === undefined ? 'false' : (!props.dryRun).toString();

    if (props.nugetApiKeySecret.assumeRoleArn) {
      environment.NUGET_ROLE_ARN = props.nugetApiKeySecret.assumeRoleArn;
    }

    if (props.nugetApiKeySecret.region) {
      environment.NUGET_SECRET_REGION = props.nugetApiKeySecret.region;
    } else {
      environment.NUGET_SECRET_REGION = Stack.of(this).region;
    }

    environment.NUGET_SECRET_ID = props.nugetApiKeySecret.secretArn;

    if (props.codeSign) {
      environment.CODE_SIGNING_SECRET_ID = props.codeSign.credential.secretArn;
      environment.CODE_SIGNING_PARAMETER_NAME = props.codeSign.principal.parameterName;
    }

    const shellable = new Shellable(this, 'Default', {
      platform: new LinuxPlatform(props.buildImage ?? cbuild.LinuxBuildImage.fromDockerRegistry('jsii/superchain')),
      scriptDirectory: path.join(__dirname, 'publishing', 'nuget'),
      entrypoint: 'publish.sh',
      environment,
    });

    if (shellable.role) {
      if (props.nugetApiKeySecret.assumeRoleArn) {
        permissions.grantAssumeRole(props.nugetApiKeySecret.assumeRoleArn, shellable.role);
      } else {
        permissions.grantSecretRead(props.nugetApiKeySecret, shellable.role);
      }

      if (props.codeSign) {
        props.codeSign.grantDecrypt(shellable.role);
      }
    }

    this.role = shellable.role;
    this.project = shellable.project;
  }