Last active
April 27, 2023 12:20
-
-
Save kylegalbraith/8aff085266b04f87dc738c8763e67bd2 to your computer and use it in GitHub Desktop.
buildspec.yml with CloudFront invalidation
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
version: 0.2 | |
phases: | |
install: | |
commands: | |
- echo "install step" | |
pre_build: | |
commands: | |
- echo "pre_build step" | |
build: | |
commands: | |
- aws s3 sync --delete . "s3://<your-static-website-bucket>" | |
post_build: | |
commands: | |
- aws cloudfront create-invalidation --distribution-id <your-distribution-id> --paths '/*' |
each phase has option to abort or continue on failure
on-failure: ABORT | CONTINUE
https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
p.s. in this file aws s3 sync is used, you can actually use code build artifacts to upload to s3
Hi Guys, Can this be done in a cross-account ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice workaround.
Is there another way to achieve this? I know that post command will run even if the build fails ?