bhall2001 / serverless-nextjs-github-ci-cd

How to use Github actions to manage the CI/CD flow of a serverless-nextjs project.
MIT License
79 stars 11 forks source link

Only sync .serverless state if files exist, without having to comment out the step #13

Open WarcraftYax opened 3 years ago

WarcraftYax commented 3 years ago

You can get around the awkward "comment out this step for first run" if you use a bash if statement to check if files exist at that path or not before trying to sync from it:

if [[ $(aws s3 ls ${{ env.SERVERLESS_STATE_BUCKET_PATH }} | head) ]]; then aws s3 sync ${{ env.SERVERLESS_STATE_BUCKET_PATH }} .serverless --delete; fi