我有一个通过 gitlab 管道使用 CDK 部署的 aws s3 + cloudfront 网页。 (代码仓库在这里:https://github.com/ruwanindika/website)
Gitlab 阶段是“构建”-->“部署”
script:
- sed -i "s/%%VERSION%%/$CI_COMMIT_SHORT_SHA/" /builds/personal1741534/website/dist/index.html
script:
- cdk bootstrap
- cdk deploy --require-approval never
用于存储桶部署的CDK代码如下:
new BucketDeployment(this, "BucketDeployment", {
destinationBucket: bucket,
sources: [Source.asset("/builds/personal1741534/website/dist")],
distribution,
distributionPaths: ["/*"],
});
我期望在 gitlab 管道的构建步骤中更新的 index.html 文件将部署到 s3 并在网页中可见。