-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b291907
commit 3f6e9d8
Showing
4 changed files
with
32 additions
and
67 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,5 @@ group :jekyll_plugins do | |
gem 'kramdown' | ||
gem 'rouge' | ||
end | ||
|
||
gem "webrick", "~> 1.8" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,7 @@ DEPENDENCIES | |
jekyll-sitemap | ||
kramdown | ||
rouge | ||
webrick (~> 1.8) | ||
|
||
BUNDLED WITH | ||
2.5.11 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copy Jekyll site to S3 bucket | ||
# | ||
#################################### | ||
# | ||
# Custom vars | ||
# | ||
s3_bucket="s3://ryanpadilha.com.br/" | ||
distribution_id=E1XURO2RK025Q0 | ||
#################################### | ||
|
||
set -e # halt script on error | ||
set -v # echo on | ||
|
||
tempfile=$(mktemp) | ||
|
||
echo "Building site..." | ||
JEKYLL_ENV=production bundle exec jekyll build | ||
|
||
echo "Removing .html extension" | ||
find _site/ -type f ! -iname 'index.html' -iname '*.html' -print0 | while read -d $'\0' f; do mv "$f" "${f%.html}"; done | ||
|
||
echo "Copying files to server..." | ||
aws s3 sync _site/ $(s3_bucket) --size-only --exclude "*" --include "*.*" --delete | tee -a $(tempfile) | ||
echo "Copying files with content type..." | ||
aws s3 sync _site/ $(s3_bucket) --size-only --content-type text/html --exclude "*.*" --delete | tee -a $(tempfile) | ||
#invalidate only modified files | ||
grep "upload\|deleted" $(tempfile) | sed -e "s|.*upload.*to $(s3_bucket)|/|" | sed -e "s|.*delete: $(s3_bucket)|/|" | sed -e 's/index.html//' | sed -e 's/\(.*\).html/\1/' | tr '\n' ' ' | xargs aws cloudfront create-invalidation --distribution-id $(distribution_id) --paths |
This file was deleted.
Oops, something went wrong.