Hacker News new | ask | show | jobs
by tfolbrecht 3134 days ago
Cool! I could see why this would work well for teams and collaboration. Here's my hugo+aws pipeline for my personal blog.

Do editing, with hugo in server mode so I can WYSIWYG edit my pages. Then run a bash script:

   #!/bin/bash

   # build site from markdown + template
   hugo ~/sitedir/

   # post to S3 bucket which is a file storage service
   aws s3 sync ~/sitedir/public s3:sitedirbuckket --recursive

   # invalidate CDN distribution so content delivery is nice and fresh!
   aws cloudfront create-invalidation --distribution-id XXXXXXXXXX --paths /*

   echo -e "All done"
2 comments

This is almost line-for-line my setup.

I like the CodeBuild solution for the times when I'm editing on my phone or a shared computer. I push to GitHub, and CodeBuild handles:

* build (as above, plus asset processing and minification)

* deploy (s3 sync, plus some fiddling to add 301 redirects)

* ping search engines

I keep a lot of drafts and temporary notes in my local checkouts and doing build/deploy on a fresh checkout helps to ensure they don't slip onto the public website.

Hey, thanks for sharing your setup. What's this thing about `ping search engines`?
To refresh the crawled cache the search engines have. I've never given it much thought, but I guess it would be refreshed when queried. I will add it to my bash script for funzies.

Here's the implementation in the sister comment: https://github.com/thom-nic/jekyll-s3_deploy/blob/master/lib...

related: I wrote a plugin to do the same for Jekyll, although it does not (yet) do cloudfront invalidation: https://github.com/thom-nic/jekyll-s3_deploy
Looks good. gzip is implemented on cloudfront instances via a flag, so you can kill two todos by implementing it!

I wonder how much cool stuff you could add to this build gem. Minification, staging, SCSS, etc.

Doesn't Jekyll already handle minification and CSS preprocessing?