When attempting to execute `cdk deploy` on GitHub Actions, I encountered an issue with finding the build from frontendapp. I double-checked the build path for any errors but found none. Interestingly, running `cdk deploy --all` locally successfully displays the website content coming from frontendapp/build.
The error message received was:
Error: Cannot find asset at /home/runner/work/CDK_Test/CDK_Test/frontend/frontendapp/build
...
Subprocess exited with error 1
Error: Process completed with exit code 1.
.github/workflows/deploy.yml:
name: Deploy to AWS
on:
push:
branches:
- main
permissions:
id-token: write
contents: read
env:
AWS_REGION: 'us-east-1'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies
run: npm install
... (remaining workflow steps omitted for brevity)
cdk/lib/cdk_test-frontend-stack.ts snippet codes:
const distribution = new cloudfront.CloudFrontWebDistribution(
this,
"cloudfront",
{
originConfigs: [
... (snippet continuation)
});
new s3deploy.BucketDeployment(this, "DeployWebsite", {
sources: [s3deploy.Source.asset("./frontend/frontendapp/build")],
destinationBucket: websiteBucket,
distribution,
});
Listing of files and directories under frontend/frontendapp/build:
- static (dir)
- asset-manifest.json
- favicon.ico
- index.html
- logo512.png
- manifest.json
- robots.txt
I have attempted to run `npm run build` within frontend/frontendapp before pushing to GitHub for automated CDK deployment. Despite this, the deployment failed. Any suggestions or solutions would be greatly appreciated. Thank you!