GitHubConnection: Type: AWS::CodeStarConnections::Connection Properties: ConnectionName: bonefish-github ProviderType: GitHub
GitHubConnection: Type: AWS::CodeStarConnections::Connection Properties: ConnectionName: bonefish-github ProviderType: GitHub
GitHubConnection: Type: AWS::CodeStarConnections::Connection Properties: ConnectionName: bonefish-github ProviderType: GitHub
ArtifactBucket: Type: AWS::S3::Bucket Properties: BucketName: !Sub 'bonefish-pipeline-artifacts-${AWS::AccountId}' VersioningConfiguration: Status: Enabled PublicAccessBlockConfiguration: BlockPublicAcls: true BlockPublicPolicy: true IgnorePublicAcls: true RestrictPublicBuckets: true
ArtifactBucket: Type: AWS::S3::Bucket Properties: BucketName: !Sub 'bonefish-pipeline-artifacts-${AWS::AccountId}' VersioningConfiguration: Status: Enabled PublicAccessBlockConfiguration: BlockPublicAcls: true BlockPublicPolicy: true IgnorePublicAcls: true RestrictPublicBuckets: true
ArtifactBucket: Type: AWS::S3::Bucket Properties: BucketName: !Sub 'bonefish-pipeline-artifacts-${AWS::AccountId}' VersioningConfiguration: Status: Enabled PublicAccessBlockConfiguration: BlockPublicAcls: true BlockPublicPolicy: true IgnorePublicAcls: true RestrictPublicBuckets: true
BuildProject: Type: AWS::CodeBuild::Project Properties: Name: bonefish-build ServiceRole: !GetAtt CodeBuildRole.Arn Artifacts: Type: CODEPIPELINE Environment: Type: LINUX_CONTAINER ComputeType: BUILD_GENERAL1_SMALL Image: aws/codebuild/standard:7.0 EnvironmentVariables: - Name: S3_BUCKET Value: !Ref S3BucketName - Name: DISTRIBUTION_ID Value: !Ref DistributionId Source: Type: CODEPIPELINE BuildSpec: buildspec.yml
BuildProject: Type: AWS::CodeBuild::Project Properties: Name: bonefish-build ServiceRole: !GetAtt CodeBuildRole.Arn Artifacts: Type: CODEPIPELINE Environment: Type: LINUX_CONTAINER ComputeType: BUILD_GENERAL1_SMALL Image: aws/codebuild/standard:7.0 EnvironmentVariables: - Name: S3_BUCKET Value: !Ref S3BucketName - Name: DISTRIBUTION_ID Value: !Ref DistributionId Source: Type: CODEPIPELINE BuildSpec: buildspec.yml
BuildProject: Type: AWS::CodeBuild::Project Properties: Name: bonefish-build ServiceRole: !GetAtt CodeBuildRole.Arn Artifacts: Type: CODEPIPELINE Environment: Type: LINUX_CONTAINER ComputeType: BUILD_GENERAL1_SMALL Image: aws/codebuild/standard:7.0 EnvironmentVariables: - Name: S3_BUCKET Value: !Ref S3BucketName - Name: DISTRIBUTION_ID Value: !Ref DistributionId Source: Type: CODEPIPELINE BuildSpec: buildspec.yml
Pipeline: Type: AWS::CodePipeline::Pipeline Properties: Name: bonefish-website-pipeline RoleArn: !GetAtt PipelineRole.Arn PipelineType: V2 Stages: - Name: Source Actions: - Name: GitHub ActionTypeId: Category: Source Owner: AWS Provider: CodeStarSourceConnection Version: '1' Configuration: ConnectionArn: !Ref GitHubConnection FullRepositoryId: !Sub '${GitHubOwner}/${GitHubRepo}' BranchName: !Ref GitHubBranch DetectChanges: true OutputArtifacts: - Name: SourceArtifact - Name: Build Actions: - Name: BuildAndDeploy ActionTypeId: Category: Build Owner: AWS Provider: CodeBuild Version: '1' Configuration: ProjectName: !Ref BuildProject InputArtifacts: - Name: SourceArtifact
Pipeline: Type: AWS::CodePipeline::Pipeline Properties: Name: bonefish-website-pipeline RoleArn: !GetAtt PipelineRole.Arn PipelineType: V2 Stages: - Name: Source Actions: - Name: GitHub ActionTypeId: Category: Source Owner: AWS Provider: CodeStarSourceConnection Version: '1' Configuration: ConnectionArn: !Ref GitHubConnection FullRepositoryId: !Sub '${GitHubOwner}/${GitHubRepo}' BranchName: !Ref GitHubBranch DetectChanges: true OutputArtifacts: - Name: SourceArtifact - Name: Build Actions: - Name: BuildAndDeploy ActionTypeId: Category: Build Owner: AWS Provider: CodeBuild Version: '1' Configuration: ProjectName: !Ref BuildProject InputArtifacts: - Name: SourceArtifact
Pipeline: Type: AWS::CodePipeline::Pipeline Properties: Name: bonefish-website-pipeline RoleArn: !GetAtt PipelineRole.Arn PipelineType: V2 Stages: - Name: Source Actions: - Name: GitHub ActionTypeId: Category: Source Owner: AWS Provider: CodeStarSourceConnection Version: '1' Configuration: ConnectionArn: !Ref GitHubConnection FullRepositoryId: !Sub '${GitHubOwner}/${GitHubRepo}' BranchName: !Ref GitHubBranch DetectChanges: true OutputArtifacts: - Name: SourceArtifact - Name: Build Actions: - Name: BuildAndDeploy ActionTypeId: Category: Build Owner: AWS Provider: CodeBuild Version: '1' Configuration: ProjectName: !Ref BuildProject InputArtifacts: - Name: SourceArtifact
PipelineRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Principal: Service: codepipeline.amazonaws.com Action: sts:AssumeRole Policies: - PolicyName: PipelinePolicy PolicyDocument: Statement: - Sid: ArtifactBucket Effect: Allow Action: [s3:GetObject, s3:PutObject, s3:GetObjectVersion, s3:GetBucketVersioning] Resource: [!Sub '${ArtifactBucket.Arn}', !Sub '${ArtifactBucket.Arn}/*'] - Sid: CodeBuild Effect: Allow Action: [codebuild:BatchGetBuilds, codebuild:StartBuild] Resource: !GetAtt BuildProject.Arn - Sid: CodeStarConnection Effect: Allow Action: [codestar-connections:UseConnection] Resource: !Ref GitHubConnection
PipelineRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Principal: Service: codepipeline.amazonaws.com Action: sts:AssumeRole Policies: - PolicyName: PipelinePolicy PolicyDocument: Statement: - Sid: ArtifactBucket Effect: Allow Action: [s3:GetObject, s3:PutObject, s3:GetObjectVersion, s3:GetBucketVersioning] Resource: [!Sub '${ArtifactBucket.Arn}', !Sub '${ArtifactBucket.Arn}/*'] - Sid: CodeBuild Effect: Allow Action: [codebuild:BatchGetBuilds, codebuild:StartBuild] Resource: !GetAtt BuildProject.Arn - Sid: CodeStarConnection Effect: Allow Action: [codestar-connections:UseConnection] Resource: !Ref GitHubConnection
PipelineRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Principal: Service: codepipeline.amazonaws.com Action: sts:AssumeRole Policies: - PolicyName: PipelinePolicy PolicyDocument: Statement: - Sid: ArtifactBucket Effect: Allow Action: [s3:GetObject, s3:PutObject, s3:GetObjectVersion, s3:GetBucketVersioning] Resource: [!Sub '${ArtifactBucket.Arn}', !Sub '${ArtifactBucket.Arn}/*'] - Sid: CodeBuild Effect: Allow Action: [codebuild:BatchGetBuilds, codebuild:StartBuild] Resource: !GetAtt BuildProject.Arn - Sid: CodeStarConnection Effect: Allow Action: [codestar-connections:UseConnection] Resource: !Ref GitHubConnection
CodeBuildRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Principal: Service: codebuild.amazonaws.com Action: sts:AssumeRole Policies: - PolicyName: CodeBuildPolicy PolicyDocument: Statement: - Sid: Logs Effect: Allow Action: [logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents] Resource: '*' - Sid: ArtifactBucket Effect: Allow Action: [s3:GetObject, s3:PutObject, s3:GetObjectVersion] Resource: !Sub '${ArtifactBucket.Arn}/*' - Sid: WebsiteSync Effect: Allow Action: [s3:PutObject, s3:DeleteObject, s3:GetObject, s3:ListBucket] Resource: - !Sub 'arn:aws:s3:::${S3BucketName}' - !Sub 'arn:aws:s3:::${S3BucketName}/*' - Sid: CloudFrontInvalidation Effect: Allow Action: [cloudfront:CreateInvalidation] Resource: !Sub 'arn:aws:cloudfront::${AWS::AccountId}:distribution/${DistributionId}'
CodeBuildRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Principal: Service: codebuild.amazonaws.com Action: sts:AssumeRole Policies: - PolicyName: CodeBuildPolicy PolicyDocument: Statement: - Sid: Logs Effect: Allow Action: [logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents] Resource: '*' - Sid: ArtifactBucket Effect: Allow Action: [s3:GetObject, s3:PutObject, s3:GetObjectVersion] Resource: !Sub '${ArtifactBucket.Arn}/*' - Sid: WebsiteSync Effect: Allow Action: [s3:PutObject, s3:DeleteObject, s3:GetObject, s3:ListBucket] Resource: - !Sub 'arn:aws:s3:::${S3BucketName}' - !Sub 'arn:aws:s3:::${S3BucketName}/*' - Sid: CloudFrontInvalidation Effect: Allow Action: [cloudfront:CreateInvalidation] Resource: !Sub 'arn:aws:cloudfront::${AWS::AccountId}:distribution/${DistributionId}'
CodeBuildRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Principal: Service: codebuild.amazonaws.com Action: sts:AssumeRole Policies: - PolicyName: CodeBuildPolicy PolicyDocument: Statement: - Sid: Logs Effect: Allow Action: [logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents] Resource: '*' - Sid: ArtifactBucket Effect: Allow Action: [s3:GetObject, s3:PutObject, s3:GetObjectVersion] Resource: !Sub '${ArtifactBucket.Arn}/*' - Sid: WebsiteSync Effect: Allow Action: [s3:PutObject, s3:DeleteObject, s3:GetObject, s3:ListBucket] Resource: - !Sub 'arn:aws:s3:::${S3BucketName}' - !Sub 'arn:aws:s3:::${S3BucketName}/*' - Sid: CloudFrontInvalidation Effect: Allow Action: [cloudfront:CreateInvalidation] Resource: !Sub 'arn:aws:cloudfront::${AWS::AccountId}:distribution/${DistributionId}'
version: 0.2 env: variables: VITE_CONTACT_API_URL: "" # overridden by CodeBuild project env var phases: install: runtime-versions: nodejs: 20 commands: - npm ci build: commands: - npm run build post_build: commands: - aws s3 sync dist/ s3://$S3_BUCKET --delete - aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*"
version: 0.2 env: variables: VITE_CONTACT_API_URL: "" # overridden by CodeBuild project env var phases: install: runtime-versions: nodejs: 20 commands: - npm ci build: commands: - npm run build post_build: commands: - aws s3 sync dist/ s3://$S3_BUCKET --delete - aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*"
version: 0.2 env: variables: VITE_CONTACT_API_URL: "" # overridden by CodeBuild project env var phases: install: runtime-versions: nodejs: 20 commands: - npm ci build: commands: - npm run build post_build: commands: - aws s3 sync dist/ s3://$S3_BUCKET --delete - aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*"