Skip to content

Instantly share code, notes, and snippets.

@hankchanocd
Last active December 9, 2020 14:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hankchanocd/5e1320ffd546c9e6a09d2723b3b971b1 to your computer and use it in GitHub Desktop.
Save hankchanocd/5e1320ffd546c9e6a09d2723b3b971b1 to your computer and use it in GitHub Desktop.
GH Actions to Deploy Jekyll Site to S3
name: Deploy Jekyll Site to S3
on: [push]
jobs:
run:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
- name: Bundle install
run: |
gem install bundler:2.1.4
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Build Jekyll
run: |
bundle exec jekyll build
- name: Deploy to S3 & Invalidate CloudFront
uses: reggionick/s3-deploy@v3
with:
folder: _site
bucket: ${{ secrets.S3_BUCKET }}
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
invalidation: /
delete-removed: true
no-cache: true
private: true
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment