Created
September 8, 2022 20:48
-
-
Save kronis/7e9ea920799d688de5cfda5ea7f65982 to your computer and use it in GitHub Desktop.
AWS CDK CodePipeLines with private NPM repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const GHSecret = Secret.fromSecretNameV2(scope, 'GHSecret', 'github/read_registry'); | |
const codeStarArn = ''; | |
const input = CodePipelineSource.connection(props.repositoryName, props.repositoryBranch, { | |
connectionArn: codeStarArn | |
}); | |
return new CodePipeline(scope, `Pipeline`, { | |
synthCodeBuildDefaults: { | |
buildEnvironment: { | |
environmentVariables: { | |
GITHUB_ACCESS_TOKEN: { | |
value: `${GHSecret.secretName}:GITHUB_ACCESS_TOKEN`, | |
type: BuildEnvironmentVariableType.SECRETS_MANAGER, | |
}, | |
}, | |
}, | |
}, | |
codeBuildDefaults: { | |
buildEnvironment: { | |
environmentVariables: { | |
GITHUB_ACCESS_TOKEN: { | |
value: `${GHSecret.secretName}:GITHUB_ACCESS_TOKEN`, | |
type: BuildEnvironmentVariableType.SECRETS_MANAGER, | |
}, | |
}, | |
}, | |
}, | |
synth: new ShellStep('Synth', { | |
input, | |
commands: [ | |
'mv -f .npmrc_ci .npmrc 2>/dev/null; true', | |
'npm ci', | |
'npm run build', | |
'npx cdk synth', | |
], | |
}), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment