Skip to content

Commit

Permalink
update gemfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpadilha committed Jun 10, 2024
1 parent b291907 commit 3f6e9d8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 67 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ group :jekyll_plugins do
gem 'kramdown'
gem 'rouge'
end

gem "webrick", "~> 1.8"
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ DEPENDENCIES
jekyll-sitemap
kramdown
rouge
webrick (~> 1.8)

BUNDLED WITH
2.5.11
29 changes: 29 additions & 0 deletions deploy.sh
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
67 changes: 0 additions & 67 deletions s3_website.yml

This file was deleted.

0 comments on commit 3f6e9d8

Please sign in to comment.