Publish Jekyll to S3 and invalidate CloudFront cache automatically with Wercker
I wrote a custom Wercker deploy step to invalidate CloudFront cache because it was not supported by the official s3sync step. But in Feb 24, 2015, wercker team has upgraded s3cmd to 1.5.1.2. Means that if you followed those tutorials to setup your Jekyll blog:
- Configure a Bucket for Website Hosting
- Simplify your Jekyll publishing process with wercker and Amazon S3
- Using CloudFront with Amazon S3
You can simply add this option and wercker will do the rest for you:
# in wercker.yml
deploy:
steps:
- s3sync:
key_id: $KEY
key_secret: $SECRET
bucket_url: $URL
source_dir: _site/
+ opts: --cf-invalidate
It will invalidate the path for default index (/subdir/
). If you’d like to invalidate default index (/subdir/index.html
) or both. Add applicable options:
--cf-invalidate-default-index
: Will invalidate/subdir/index.html
--cf-no-invalidate-default-index-root
: Will NOT invalidate/subdir/
Details are in s3cmd tool Usage.
喜歡這篇文章嗎?你可能也會喜歡我的學習電子報,我會分享經過篩選的優質內容 + 學習心得
📚 訂閱我的學習電子報
📖 涵蓋主題:
🧑💻 軟體工程
🎯 生產力
💰 商業理財
🧳 創業
🐱 奇怪的知識增加了
💭 思考人生心得
🎁 現在訂閱就送我個人非常愛用的「學習任何領域皮毛的 AI Prompt」!
立即免費訂閱 →
✨ 不浪費你的時間,只分享達到我標準的優質內容